mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-12-26 06:17:54 +01:00
update README.md to suggest an Idea to people who want to try building for themselves, and to add the fact that artists can be done from spotify with this revision. add gradlew.bat to help compile for linux, add artistAlbums.kt to set data type for the retreival of the artists discordography, edit Artist.kt to add profile photo retrival, edit SpotifyRequests.kt to allow retrival of artist data by id and artist dicordography, and edit SpotifyProvider.kt to get artist discordography, and then get the tracks from the albums.
This commit is contained in:
parent
6de4a0e106
commit
b88c119a01
@ -8,7 +8,7 @@
|
||||
# SpotiFlyer
|
||||
- **Kotlin Multiplatform** Music Downloader ,supports **Spotify, Youtube, Gaana, Jio-Saavn and SoundCloud**.
|
||||
|
||||
Supports- Playlist, Albums, Tracks. _(If You know Any Source for Episodes/Podcasts create an Issue sharing It.)_
|
||||
Supports- Playlist, Albums, Artists(currently only on spotify), Tracks. _(If You know Any Source for Episodes/Podcasts create an Issue sharing It.)_
|
||||
|
||||
**Currently running on:**
|
||||
- [Android (Jetpack Compose)](https://github.com/Shabinder/SpotiFlyer#-install)
|
||||
@ -26,7 +26,7 @@ Supports- Playlist, Albums, Tracks. _(If You know Any Source for Episodes/Podcas
|
||||
***Encourage this repo by giving it a Star⭐ .***
|
||||
|
||||
SpotiFlyer is an **App**(Written in **Kotlin**), which **aims** to work as:
|
||||
- **Downloads**: Albums, Tracks and Playlists,etc
|
||||
- **Downloads**: Albums, Artists(currently only on spotify), Tracks and Playlists,etc
|
||||
- **Save your Data** ,by not **_Streaming_** your Fav Songs Online again & again(Just Download Them!)
|
||||
- **No ADS!**
|
||||
- **Works straight out of the box** and does not require you to generate or mess with your API keys (already included).
|
||||
@ -74,6 +74,7 @@ Want to contribute? Great!
|
||||
All contributions are welcome, from code to documentation to graphics to design suggestions to bug reports. Please use GitHub to its fullest-- contribute Pull Requests, contribute tutorials or other wiki content-- whatever you have to offer, we can use it!
|
||||
|
||||
- For **Translations** , read [Contributing.md](https://github.com/Shabinder/SpotiFlyer/blob/main/CONTRIBUTING.md)
|
||||
- For **Building for other tests**, you can use github actions with the workflow files, or manually do them with the commands and inferred setups in .github/workflows/ and gradlew.bat/.bash (windows/linux)
|
||||
|
||||
**Please Donate to support me and my work!**
|
||||
</br>
|
||||
|
@ -25,5 +25,6 @@ data class Artist(
|
||||
var id: String? = null,
|
||||
var name: String? = null,
|
||||
var type: String? = null,
|
||||
var uri: String? = null
|
||||
var uri: String? = null,
|
||||
var images: List<Image?>? = null
|
||||
)
|
||||
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Shabinder Singh
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.shabinder.common.models.spotify
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class artistAlbums(
|
||||
var href: String? = null,
|
||||
var items: List<Album?>? = null,
|
||||
var limit: Int? = null,
|
||||
var next: String? = null,
|
||||
var previous: String? = null,
|
||||
var offset: Int? = null,
|
||||
var total: Int? = null
|
||||
)
|
@ -141,6 +141,36 @@ class SpotifyProvider(
|
||||
}
|
||||
}
|
||||
|
||||
"artist" -> {
|
||||
//get all of the artists albums
|
||||
val artistObject = getArtist(link)
|
||||
//and his image, etc for later
|
||||
val artistDataObject = getArtistData(link);
|
||||
//now run some modified code from the album handler /\ in a loop for each album made by the author
|
||||
artistObject.items?.forEach {
|
||||
val albumObject = getAlbum(it?.id.toString())
|
||||
folderType = "Artists"
|
||||
subFolder = artistDataObject?.name.toString()
|
||||
albumObject.tracks?.items?.forEach { it.album = albumObject }
|
||||
albumObject.tracks?.items?.toTrackDetailsList(folderType, subFolder).let {
|
||||
if (it.isNullOrEmpty()) {
|
||||
// TODO Handle Error
|
||||
} else {
|
||||
//title and cover are artists, not albums
|
||||
//tempTrackList.addAll(it);
|
||||
//println(tempTrackList);
|
||||
//and the track list needs to be added up, not just the last album
|
||||
//(might cause problems with previous runs residual tracks, depends on the rest of the code.)
|
||||
trackList = trackList+it;
|
||||
}
|
||||
}
|
||||
}
|
||||
//and set the title and image from the author data above
|
||||
title = artistDataObject?.name.toString();
|
||||
coverUrl = artistDataObject?.images?.elementAtOrNull(0)?.url.toString();
|
||||
//trackList = tempTrackList.toTrackDetailsList(folderType, subFolder);
|
||||
}
|
||||
|
||||
"playlist" -> {
|
||||
val playlistObject = getPlaylist(link)
|
||||
folderType = "Playlists"
|
||||
|
@ -19,6 +19,8 @@ package com.shabinder.common.providers.spotify.requests
|
||||
import com.shabinder.common.models.NativeAtomicReference
|
||||
import com.shabinder.common.models.corsApi
|
||||
import com.shabinder.common.models.spotify.Album
|
||||
import com.shabinder.common.models.spotify.Artist
|
||||
import com.shabinder.common.models.spotify.artistAlbums
|
||||
import com.shabinder.common.models.spotify.PagingObjectPlaylistTrack
|
||||
import com.shabinder.common.models.spotify.Playlist
|
||||
import com.shabinder.common.models.spotify.Track
|
||||
@ -64,6 +66,14 @@ interface SpotifyRequests {
|
||||
return httpClient.get("$BASE_URL/albums/$id")
|
||||
}
|
||||
|
||||
suspend fun getArtist(id: String): artistAlbums {
|
||||
return httpClient.get("$BASE_URL/artists/$id/albums?limit=50")
|
||||
}
|
||||
|
||||
suspend fun getArtistData(id: String): Artist {
|
||||
return httpClient.get("$BASE_URL/artists/$id")
|
||||
}
|
||||
|
||||
suspend fun getResponse(url: String): String {
|
||||
return httpClient.get(url)
|
||||
}
|
||||
|
78
gradlew.bash
Normal file
78
gradlew.bash
Normal file
@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# ##########################################################################
|
||||
#
|
||||
# Gradle startup script for linux
|
||||
#
|
||||
# ##########################################################################
|
||||
|
||||
# Set local scope for the variables with windows NT shell
|
||||
cd "$(dirname $0)" || echo "couldn't get current file directory properly... using fallback method of current working directory" || error 1
|
||||
export DIRNAME
|
||||
DIRNAME=$(pwd)
|
||||
cd - || echo "another error because I couldn't get gradlew's directory" || error 1
|
||||
if [[ -z $DIRNAME ]]; then DIRNAME=$(pwd); fi
|
||||
export APP_BASE_NAME=$0
|
||||
export APP_HOME=$DIRNAME
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
export DEFAULT_JVM_OPTS="-Xmx64m -Xms64m"
|
||||
|
||||
# Find java.exe
|
||||
if [[ -z $JAVA_HOME ]]; then
|
||||
|
||||
export JAVA_EXE=java
|
||||
$JAVA_EXE -version > /dev/null
|
||||
if [ ! $? == "0" ]; then
|
||||
echo .
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo .
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
export JAVA_HOME=$JAVA_HOME
|
||||
export JAVA_EXE=$JAVA_HOME/bin/java
|
||||
fi
|
||||
|
||||
if [[ -z $JAVA_EXE ]]; then
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Setup the command line
|
||||
|
||||
export CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Execute Gradle
|
||||
echo running $JAVA_EXE $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -Dorg.gradle.appname=$APP_BASE_NAME -classpath $CLASSPATH org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
$JAVA_EXE $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -Dorg.gradle.appname=$APP_BASE_NAME -classpath $CLASSPATH org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
|
||||
#crash if gradle crashes
|
||||
if [ ! $? == "0" ]; then
|
||||
echo gradle failed with exit code $?.
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue
Block a user