Unsafe List.last accessor bugfix (#issues/2)

PKGBUILD recreated & adjusted
License created
flatpak config created (dummy)
This commit is contained in:
Kingkor Roy Tirtho 2022-01-14 16:58:53 +06:00
parent a820e8a9f6
commit 44760aab6f
7 changed files with 57 additions and 25 deletions

12
LICENSE Normal file
View File

@ -0,0 +1,12 @@
BSD 4-Clause License
Copyright (c) 2022 Kingkor Roy Tirtho. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software must display the following acknowledgement:
This product includes software developed by Kingkor Roy Tirtho.
4. Neither the name of the Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY KINGKOR ROY TIRTHO AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KINGKOR ROY TIRTHO AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,13 +1,11 @@
pkgbase = spotube-bin
pkgdesc = A music streaming app combining the power of Spotify & Youtube
pkgver = 0.0.3
pkgbase = spotube
pkgdesc = A lightweight free Spotify desktop-client which handles playback manually, streams music using Youtube & no Spotify premium account is needed
pkgver = 1.0.0
pkgrel = 1
url = https://github.com/KRTirtho/spotube/
arch = x86_64
license = MIT
depends = mpv
depends = youtube-dl
source = https://github.com/KRTirtho/spotube//releases/download/v0.0.3/Spotube_linux-x86_64-v0.0.3.zip
license = BSD 4-Clause
source = https://github.com/KRTirtho/spotube/releases/download/v1.0.0/Spotube-linux-x86_64.tar.xz
pkgname = spotube-bin
pkgname = spotube

View File

@ -1,14 +1,14 @@
# Maintainer: KRTirtho <krtirho@gmail.com>
# Maintainer: Kingkor Roy Tirtho <krtirho@gmail.com>
pkgname=spotube
pkgver=1.0.0
pkgrel=1
epoch=
pkgdesc="A music streaming app combining the power of Spotify & Youtube"
pkgdesc="A lightweight free Spotify desktop-client which handles playback manually, streams music using Youtube & no Spotify premium account is needed"
arch=(x86_64)
url="https://github.com/KRTirtho/spotube/"
license=('MIT')
license=('BSD 4-Clause')
groups=()
depends=('mpv' 'yt-dlp')
depends=()
makedepends=()
checkdepends=()
optdepends=()
@ -19,17 +19,18 @@ backup=()
options=()
install=
changelog=
source=("./spotube-v1.0.0-linux-x86-64.tar")
source=("https://github.com/KRTirtho/spotube/releases/download/v${version}/Spotube-linux-x86_64.tar.xz")
noextract=()
md5sums=(a58727a9233d7d381872be59b622f864)
md5sums=(f1830c1edf38c236416bdd3bd33ec845)
validpgpkeys=()
package(){
install -dm755 "${pkgdir}/usr/share/icons/${pkgname}"
install -dm755 "${pkgdir}/usr/share/applications"
install -dm755 "${pkgdir}/usr/share/${pkgname}"
install -dm755 "${pkgdir}/usr/bin"
cp -ra ./ "${pkgdir}/usr/share/${pkgname}"
cp ./spotube.desktop ~/.local/share/applications
cp ./data/flutter_assets/assets/spotube-logo.png "${pkgdir}/usr/share/icons/${pkgname}"
cp ./spotube.desktop "${pkgdir}/usr/share/applications"
cp ./spotube-logo.png "${pkgdir}/usr/share/icons/${pkgname}"
ln -s "/usr/share/${pkgname}/spotube" "${pkgdir}/usr/bin/${pkgname}"
}

View File

@ -185,7 +185,11 @@ class _HomeState extends State<Home> {
return FutureBuilder<User>(
future: data.spotifyApi.me.get(),
builder: (context, snapshot) {
var avatarImg = snapshot.data?.images?.last.url;
var avatarImg = ((snapshot.data?.images?.isNotEmpty ??
false) &&
snapshot.data?.images?.last.url != null)
? snapshot.data!.images!.last.url!
: "https://avatars.dicebear.com/api/human/${snapshot.data?.id}.png";
return Padding(
padding: const EdgeInsets.all(16),
child: Row(
@ -193,11 +197,10 @@ class _HomeState extends State<Home> {
children: [
Row(
children: [
if (avatarImg != null)
CircleAvatar(
backgroundImage:
CachedNetworkImageProvider(avatarImg),
),
CircleAvatar(
backgroundImage:
CachedNetworkImageProvider(avatarImg),
),
const SizedBox(width: 10),
Text(
snapshot.data?.displayName ?? "User's name",

View File

@ -227,7 +227,10 @@ class _PlayerState extends State<Player> with WidgetsBindingObserver {
_playTrack(playback.currentTrack!, playback);
}
String? albumArt = playback.currentTrack?.album?.images?.last.url;
String? albumArt =
(playback.currentTrack?.album?.images?.isNotEmpty ?? false)
? playback.currentTrack?.album?.images?.last.url
: null;
return Material(
type: MaterialType.transparency,

View File

@ -17,8 +17,10 @@ class PlaylistView extends StatefulWidget {
class _PlaylistViewState extends State<PlaylistView> {
List<TableRow> trackToTableRow(List<Track> tracks) {
return tracks.asMap().entries.map((track) {
var thumbnailUrl = track.value.album?.images?.last.url;
var duration =
String? thumbnailUrl = (track.value.album?.images?.isNotEmpty ?? false)
? track.value.album?.images?.last.url
: null;
String duration =
"${track.value.duration?.inMinutes.remainder(60)}:${zeroPadNumStr(track.value.duration?.inSeconds.remainder(60) ?? 0)}";
return (TableRow(
children: [

13
oss.krtirtho.Spotube.yml Normal file
View File

@ -0,0 +1,13 @@
app-id: oss.krtirtho.Spotube
runtime: org.freedesktop.Platform
runtime-version: '21.08'
sdk: org.freedesktop.Sdk
command: spotube
modules:
- name: spotube
buildsystem: simple
build-commands:
- install -D hello.sh /app/bin/hello.sh
sources:
- type: file
path: hello.sh