├── .github └── workflows │ ├── auto-update.yml │ ├── build-image.yaml │ └── publish-to-testing.yml ├── Dockerfile ├── LICENSE ├── README.md ├── requirements.txt ├── spotspot ├── __init__.py ├── services │ ├── __init__.py │ ├── config_service.py │ ├── download_service.py │ ├── playlist_manager.py │ └── spotfiy_service.py ├── spotspot.py ├── static │ ├── full-logo.png │ ├── js_general_script.js │ ├── js_status_script.js │ ├── js_theme_switcher.js │ ├── logo.png │ ├── phone-screenshot.png │ ├── screenshot.png │ ├── spotspot.png │ └── style.css └── templates │ ├── index.html │ └── status.html ├── start.sh └── start_app.py /.github/workflows/auto-update.yml: -------------------------------------------------------------------------------- 1 | name: Check and Update yt-dlp and spotdl versions 2 | 3 | on: 4 | schedule: 5 | - cron: '0 12 * * *' 6 | workflow_dispatch: 7 | 8 | jobs: 9 | check-versions: 10 | runs-on: ubuntu-latest 11 | outputs: 12 | updated_flag: ${{ steps.check_flags.outputs.updated_flag }} 13 | 14 | steps: 15 | - name: Checkout code 16 | uses: actions/checkout@v4 17 | with: 18 | token: ${{ secrets.PAT }} 19 | 20 | - name: Set up Python 21 | uses: actions/setup-python@v5 22 | with: 23 | python-version: '3.12' 24 | 25 | - name: Get latest yt-dlp and spotdl versions 26 | id: get_latest_versions 27 | run: | 28 | pip install yt-dlp spotdl 29 | latest_ytdlp=$(yt-dlp --version) 30 | latest_spotdl=$(spotdl --version) 31 | echo "Latest yt-dlp version: $latest_ytdlp" 32 | echo "Latest spotdl version: $latest_spotdl" 33 | echo "latest_ytdlp=$latest_ytdlp" >> $GITHUB_ENV 34 | echo "latest_spotdl=$latest_spotdl" >> $GITHUB_ENV 35 | 36 | - name: Extract versions from requirements.txt 37 | id: extract_versions 38 | run: | 39 | current_ytdlp=$(grep -oP "(?<=yt_dlp\[default\]==)\d+(\.\d+)+" requirements.txt || echo "0.0") 40 | current_spotdl=$(grep -oP "(?<=spotdl==)\d+(\.\d+)+" requirements.txt || echo "0.0") 41 | echo "Version in requirements.txt - yt-dlp: $current_ytdlp, spotdl: $current_spotdl" 42 | echo "current_ytdlp=$current_ytdlp" >> $GITHUB_ENV 43 | echo "current_spotdl=$current_spotdl" >> $GITHUB_ENV 44 | 45 | - name: Update yt-dlp in requirements.txt if new version available 46 | id: update_ytdlp 47 | run: | 48 | if [ "${{ env.latest_ytdlp }}" != "${{ env.current_ytdlp }}" ]; then 49 | sed -i "s/^yt_dlp.*/yt_dlp[default]==${{ env.latest_ytdlp }}/" requirements.txt 50 | git config --global user.email "updater@spotspot" 51 | git config --global user.name "AutoUpdater" 52 | git commit -m "Update yt-dlp to ${{ env.latest_ytdlp }}" requirements.txt 53 | git push 54 | echo "updated_flag=true" >> $GITHUB_OUTPUT 55 | echo "yt_dlp_updated_flag=true" >> $GITHUB_ENV 56 | else 57 | echo "yt_dlp_updated_flag=false" >> $GITHUB_ENV 58 | fi 59 | 60 | - name: Update spotdl in requirements.txt if new version available 61 | id: update_spotdl 62 | run: | 63 | if [ "${{ env.latest_spotdl }}" != "${{ env.current_spotdl }}" ]; then 64 | sed -i "s/^spotdl.*/spotdl==${{ env.latest_spotdl }}/" requirements.txt 65 | git config --global user.email "updater@spotspot" 66 | git config --global user.name "AutoUpdater" 67 | git commit -m "Update spotdl to ${{ env.latest_spotdl }}" requirements.txt 68 | git push 69 | echo "spotdl_updated_flag=true" >> $GITHUB_ENV 70 | else 71 | echo "spotdl_updated_flag=false" >> $GITHUB_ENV 72 | fi 73 | 74 | - name: Check if release is needed 75 | id: check_flags 76 | run: | 77 | if [ "${{ env.yt_dlp_updated_flag }}" == "true" ] || [ "${{ env.spotdl_updated_flag }}" == "true" ]; then 78 | echo "updated_flag=true" >> $GITHUB_OUTPUT 79 | else 80 | echo "updated_flag=false" >> $GITHUB_OUTPUT 81 | fi 82 | 83 | generate-release: 84 | runs-on: ubuntu-latest 85 | needs: check-versions 86 | if: ${{ needs.check-versions.outputs.updated_flag == 'true' }} 87 | 88 | env: 89 | GH_TOKEN: ${{ secrets.PAT }} 90 | 91 | steps: 92 | - name: Checkout code 93 | uses: actions/checkout@v4 94 | with: 95 | token: ${{ secrets.PAT }} 96 | 97 | - name: Pull latest changes 98 | run: git pull origin main 99 | 100 | - name: Fetch and list tags 101 | run: | 102 | git fetch --tags 103 | echo "Tags:" 104 | git tag --list 105 | 106 | - name: Increment release 107 | id: increment_release 108 | run: | 109 | latest_tag=$(git tag --list | grep -v 'testing' | sed 's/^v//' | sort -V | tail -n 1 || echo "0.0.0") 110 | major=$(echo $latest_tag | cut -d. -f1) 111 | minor=$(echo $latest_tag | cut -d. -f2) 112 | patch=$(echo $latest_tag | cut -d. -f3) 113 | new_patch=$((patch + 1)) 114 | new_tag="v${major}.${minor}.${new_patch}" 115 | 116 | echo "CURRENT_RELEASE=$latest_tag" >> $GITHUB_ENV 117 | echo "NEW_RELEASE=$new_tag" >> $GITHUB_ENV 118 | echo "Current release: $latest_tag" 119 | echo "New release: $new_tag" 120 | 121 | - name: Create new Git tag 122 | run: | 123 | git config --global user.name 'github-actions[bot]' 124 | git config --global user.email 'github-actions[bot]@users.noreply.github.com' 125 | git tag -a ${{ env.NEW_RELEASE }} -m "Release version ${{ env.NEW_RELEASE }}" 126 | git push origin ${{ env.NEW_RELEASE }} 127 | 128 | - name: Create release 129 | run: | 130 | gh release create "${{ env.NEW_RELEASE }}" \ 131 | --repo="${GITHUB_REPOSITORY}" \ 132 | --title="${{ env.NEW_RELEASE }}" \ 133 | --generate-notes 134 | -------------------------------------------------------------------------------- /.github/workflows/build-image.yaml: -------------------------------------------------------------------------------- 1 | name: Build Image and Deploy to GHCR 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | release: 7 | types: [created] 8 | 9 | jobs: 10 | build-docker-image: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout GitHub Action 14 | uses: actions/checkout@main 15 | 16 | - name: Set up Docker Buildx 17 | uses: docker/setup-buildx-action@v3 18 | 19 | - name: Login to GitHub Container Registry 20 | uses: docker/login-action@v3 21 | with: 22 | registry: ghcr.io 23 | username: ${{ github.actor }} 24 | password: ${{ secrets.PAT }} 25 | 26 | - name: Get Version 27 | id: get_version 28 | run: | 29 | RAW_VERSION="${{ github.event.release.tag_name }}" 30 | VERSION="${RAW_VERSION#v}" 31 | echo "VERSION=${VERSION}" >> $GITHUB_ENV 32 | echo "Version = ${VERSION}" 33 | 34 | - name: Build and Push Docker Image 35 | run: | 36 | VERSION="${{ github.event.release.tag_name }}" 37 | docker buildx build \ 38 | --platform linux/amd64,linux/arm64 \ 39 | --tag ghcr.io/mattblackonly/spotspot:latest \ 40 | --tag ghcr.io/mattblackonly/spotspot:${{ env.VERSION }} \ 41 | --build-arg SPOTSPOT_VERSION=${VERSION} \ 42 | --push . 43 | -------------------------------------------------------------------------------- /.github/workflows/publish-to-testing.yml: -------------------------------------------------------------------------------- 1 | name: Publish to Testing Branch 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | push: 7 | branches: 8 | - 'testing' 9 | 10 | jobs: 11 | publish-to-testing: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout Code 15 | uses: actions/checkout@v4 16 | 17 | - name: Set up Docker Buildx 18 | uses: docker/setup-buildx-action@v3 19 | 20 | - name: Login to GitHub Container Registry 21 | uses: docker/login-action@v3 22 | with: 23 | registry: ghcr.io 24 | username: ${{ github.actor }} 25 | password: ${{ secrets.PAT }} 26 | 27 | - name: Build and Push Docker Image for Testing 28 | run: | 29 | echo "Publishing to :testing image" 30 | docker buildx build \ 31 | --platform linux/amd64,linux/arm64 \ 32 | --tag ghcr.io/mattblackonly/spotspot:testing \ 33 | --build-arg SPOTSPOT_VERSION=testing \ 34 | --push . 35 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.12-alpine 2 | 3 | # Install dependencies, including su-exec 4 | RUN apk update && apk add --no-cache ffmpeg su-exec 5 | 6 | # Create appuser and appgroup 7 | RUN addgroup -g 1000 appgroup && adduser -D -u 1000 -G appgroup appuser 8 | 9 | # Set environment variables 10 | ARG SPOTSPOT_VERSION 11 | ENV PYTHONDONTWRITEBYTECODE=1 \ 12 | PYTHONUNBUFFERED=1 \ 13 | PYTHONPATH=/app/spotspot \ 14 | SPOTSPOT_VERSION=${SPOTSPOT_VERSION} 15 | 16 | # Set the working directory 17 | WORKDIR /app 18 | 19 | # Copy the application code 20 | COPY . . 21 | 22 | # Install Python dependencies 23 | RUN pip install --upgrade pip --root-user-action=ignore && \ 24 | pip install --no-cache-dir --root-user-action=ignore -r requirements.txt 25 | 26 | # Ensure proper ownership of directories 27 | RUN mkdir -p /config /home/appuser/.spotdl/.spotipy /data && \ 28 | chown -R appuser:appgroup /config /home /data 29 | 30 | # Make script executable 31 | RUN chmod +x /app/start.sh 32 | 33 | # Expose the application port 34 | EXPOSE 6544 35 | 36 | # Use the start script as the entrypoint 37 | ENTRYPOINT ["/app/start.sh"] 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Logo](spotspot/static/spotspot.png) 2 | 3 | 4 | **SpotSpot** is a simple tool for searching Spotify and downloading via YouTube (spotDL/yt-dlp). 5 | 6 | 7 | ## Features: 8 | 9 | - **Full SpotDL Support:** Download Albums, Tracks, Playlists, and Artists. 10 | - **Playlist Generator:** Automatically generate playlists. 11 | - **Custom Filepaths:** Set your download and config directories in the settings. 12 | - **Mobile Optimized:** Designed for small screens to enhance usability on mobile devices. 13 | 14 | 15 | ## Docker Compose Configuration 16 | 17 | Create a `docker-compose.yml` file: 18 | 19 | ```yaml 20 | services: 21 | spotspot: 22 | image: ghcr.io/mattblackonly/spotspot:latest 23 | container_name: spotspot 24 | ports: 25 | - 6544:6544 26 | volumes: 27 | - /data:/data # If you need to change this also change it for the TRACK_OUTPUT, ALBUM_OUTPUT, PLAYLIST_OUTPUT, ARTIST_OUTPUT 28 | - /path/to/config:/config # Option to store cookies file 29 | - /path/to/temp:/temp # Optional. 30 | - /etc/localtime:/etc/localtime:ro # Optional. Sync time with host. 31 | - /etc/timezone:/etc/timezone:ro # Optional. Sync timezone with host. 32 | environment: 33 | - PUID=1000 34 | - PGID=1000 35 | restart: unless-stopped 36 | ``` 37 | 38 | 39 | ## 🎵 Playlist Configuration 40 | 41 | For playlists, an **absolute file path** is required in the `.m3u` playlist file. This ensures compatibility with media servers like **Plex**, which require absolute paths for proper playback. 42 | 43 | ### ✅ Key Setup Requirements: 44 | 1. **Container Path Mapping:** 45 | - The `/data` directory should be **consistently** mapped in the container: 46 | ```yml 47 | /data:/data 48 | ``` 49 | - This ensures that all media files are accessible using the same path inside and outside the container. 50 | 51 | 2. **Output Path Configuration:** 52 | - Ensure the following output paths are correctly set: 53 | - `TRACK_OUTPUT` 54 | - `ALBUM_OUTPUT` 55 | - `PLAYLIST_OUTPUT` 56 | - `ARTIST_OUTPUT` 57 | - `ABSOLUTE_SERVER_PATH` 58 | - `M3U_PLAYLIST_PATH` 59 | - These paths should align with your actual directory structure. 60 | 61 | 3. **Adjust Paths as Needed:** 62 | - If your media files are stored elsewhere, update the paths accordingly to avoid broken playlist links. 63 | 64 | 65 | ## Configuration via Environment Variables 66 | 67 | Customize the behavior of **SpotSpot** and **SpotDL** by setting the following environment variables in your `docker-compose.yml` file: 68 | 69 | ```yaml 70 | environment: 71 | # General Configuration 72 | - CONFIG_PATH=/home/appuser/.spotdl/config.json # Path where the config file will be saved (Windows default: D:/config.json, Linux default: /home/appuser/.spotdl/config.json) 73 | - FFMPEG_LOCATION= /usr/bin/ffmpeg # Location of ffmpeg executable (Windows default: D:/, Linux default: /usr/bin/ffmpeg) 74 | - TRACK_OUTPUT=/data/media/music/singles/{artist} - {title}.{output-ext} # Format for saving individual tracks (default: {artist} - {title}.{output-ext}) 75 | - ALBUM_OUTPUT=/data/media/music/{artist}/{album} - ({year})/{artist} - {title}.{output-ext} # Format for saving albums (default: {artist}/{album}/{artist} - {title}.{output-ext}) 76 | - PLAYLIST_OUTPUT=/data/media/music/{list-name}/{artist} - {title}.{output-ext} # Format for saving playlists (default: {list-name}/{artist} - {title}.{output-ext}) 77 | - ARTIST_OUTPUT=/data/media/music/{artist}/{album} - ({year})/{artist} - {title}.{output-ext} # Format for saving artist albums (default: {artist}/{album}/{artist} - {title}.{output-ext}) 78 | 79 | # Jellyfin Configuration 80 | - TRIGGER_JELLYFIN_SCAN=True # Trigger Jellyfin scan after download (default: True) 81 | - JELLYFIN_ADDRESS=http://192.168.1.123:8096 # Jellyfin server address (default: http://192.168.1.123:8096) 82 | - JELLYFIN_API_KEY="" # Jellyfin API Key (default: None) 83 | 84 | # Plex Configuration 85 | - TRIGGER_PLEX_SCAN=True # Trigger Plex scan after download (default: True) 86 | - PLEX_ADDRESS=http://192.168.1.123:32400 # Plex server address (default: http://192.168.1.123:32400) 87 | - PLEX_TOKEN="" # Plex token (default: None) 88 | - PLEX_LIBRARY_NAME=Music # Plex library name (default: Music) 89 | - PLEX_SECTION_ID=1 # Plex section ID (default: 1) 90 | - PLEX_PLAYLIST_IMPORT_DELAY=180 # Plex Playlist Import Delay (default: 180 seconds) 91 | 92 | # Playlist Configuration 93 | - GENERATE_M3U_PLAYLIST=True # Generate M3U playlist after download (default: True) 94 | - M3U_PLAYLIST_NAME=spotify_singles # Name of the M3U playlist (default: spotify_singles) 95 | - M3U_PLAYLIST_PATH=/data/media/music/playlists # Path for M3U playlist (default: /data/media/music/playlists) 96 | - M3U_PLAYLIST_SORT_ORDER=date_desc # Playlist order (default: date_desc) 97 | - ABSOLUTE_SERVER_PATH=/data/media/music/singles # Path for media files (default: /data/media/music/singles) 98 | 99 | # SpotDL Specific Configuration 100 | - CLIENT_ID=5f573c9620494bae87890c0f08a60293 # Client ID for SpotDL (default: 5f573c9620494bae87890c0f08a60293) 101 | - CLIENT_SECRET=212476d9b0f3472eaa762d90b19b0ba8 # Client secret for SpotDL (default: 212476d9b0f3472eaa762d90b19b0ba8) 102 | - AUTH_TOKEN="" # Authentication token for SpotDL (default: None) 103 | - USER_AUTH=False # Enable user authentication (default: False) 104 | - HEADLESS=False # Run in headless mode (default: False) 105 | - CACHE_PATH=/home/appuser/.spotdl/.spotipy # Cache path for SpotDL (default: /home/appuser/.spotdl/.spotipy) 106 | - NO_CACHE=True # Disable cache (default: True) 107 | - OUTPUT={artists} - {title}.{output-ext} # Output format for downloaded tracks (default: {artists} - {title}.{output-ext}) 108 | - FORMAT=mp3 # Format for output file (default: mp3) 109 | - PRELOAD=False # Preload tracks (default: False) 110 | - PORT=8800 # Port for SpotDL service (default: 8800) 111 | - HOST=localhost # Host for SpotDL service (default: localhost) 112 | - KEEP_ALIVE=False # Keep the server alive (default: False) 113 | - ENABLE_TLS=False # Enable TLS encryption (default: False) 114 | - PROXY="" # Proxy for SpotDL (default: None) 115 | - SKIP_EXPLICIT=False # Skip explicit content (default: False) 116 | 117 | # Advanced Configuration 118 | - LOG_LEVEL="DEBUG" # Log level for SpotDL (default: DEBUG) 119 | - MAX_RETRIES=3 # Max retries for SpotDL requests (default: 3) 120 | - USE_CACHE_FILE=False # Use cache file (default: False) 121 | - AUDIO_PROVIDERS="youtube-music" # Audio providers for SpotDL (default: youtube-music) 122 | - LYRIC_PROVIDERS="genius,azlyrics,musixmatch" # Lyrics providers (default: genius, azlyrics, musixmatch) 123 | - GENIUS_TOKEN="alXXDbPZtK1m2RrZ8I4k2Hn8Ahsd0Gh_o076HYvcdlBvmc0ULL1H8Z8xRlew5qaG" # Genius API token 124 | - PLAYLIST_NUMBERING=False # Enable playlist numbering (default: False) 125 | - PLAYLIST_RETAIN_TRACK_COVER=False # Retain track covers in playlist (default: False) 126 | - SCAN_FOR_SONGS=False # Scan for songs after download (default: False) 127 | - M3U="" # Custom M3U playlist (default: None) 128 | - OVERWRITE="skip" # Overwrite behavior (default: skip) 129 | - SEARCH_QUERY="" # Search query for track (default: None) 130 | - FFmpeg_ARGS="" # Custom arguments for ffmpeg (default: None) 131 | - BITRATE="" # Set bitrate for downloads (default: None) 132 | 133 | # Session and File Management 134 | - SAVE_FILE="" # Save file path (default: None) 135 | - FILTER_RESULTS=True # Enable result filtering (default: True) 136 | - THREADS=4 # Number of threads to use for downloads (default: 4) 137 | - COOKIE_FILE="" # Path to cookie file (default: None, e.g /config/cookies.txt) 138 | - PRINT_ERRORS=False # Print errors (default: False) 139 | - SPONSOR_BLOCK=False # Enable sponsor block (default: False) 140 | - ARCHIVE="" # Path to archive (default: None) 141 | - LOAD_CONFIG=True # Load configuration (default: True) 142 | - SIMPLE_TUI=False # Enable simple TUI (default: False) 143 | - FETCH_ALBUMS=False # Fetch albums (default: False) 144 | - ID3_SEPARATOR="/" # Separator for ID3 tags (default: /) 145 | 146 | # Sync and Update Options 147 | - REDOWNLOAD=False # Redownload if file exists (default: False) 148 | - SKIP_ALBUM_ART=False # Skip album art download (default: False) 149 | - CREATE_SKIP_FILE=False # Create skip file (default: False) 150 | - RESPECT_SKIP_FILE=False # Respect skip file (default: False) 151 | - SYNC_REMOVE_LRC=False # Sync and remove LRC files (default: False) 152 | - WEB_USE_OUTPUT_DIR=False # Use output directory in web (default: False) 153 | 154 | # Security Configuration 155 | - KEY_FILE="" # Path to key file (default: None) 156 | - CERT_FILE="" # Path to certificate file (default: None) 157 | - CA_FILE="" # Path to CA file (default: None) 158 | - ALLOWED_ORIGINS="" # List of allowed origins (default: None) 159 | 160 | # Session and GUI Settings 161 | - KEEP_SESSIONS=False # Keep sessions alive (default: False) 162 | - FORCE_UPDATE_GUI=False # Force update GUI (default: False) 163 | - WEB_GUI_REPO="" # Web GUI repository (default: None) 164 | - WEB_GUI_LOCATION="" # Web GUI location (default: None) 165 | ``` 166 | 167 | ## Screenshots 168 | 169 | ### Phone (Dark Mode) 170 | 171 | ![Phone](spotspot/static/phone-screenshot.png) 172 | 173 | 174 | 175 | ### Desktop (Dark Mode) 176 | 177 | ![Screenshot](spotspot/static/screenshot.png) 178 | 179 | 180 | ## Star History 181 | 182 | 183 | 184 | 185 | 186 | Star History Chart 187 | 188 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | gunicorn 2 | gevent 3 | gevent-websocket 4 | flask 5 | flask_socketio 6 | yt_dlp[default]==2025.05.22 7 | spotdl==4.2.11 8 | plexapi 9 | -------------------------------------------------------------------------------- /spotspot/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MattBlackOnly/SpotSpot/6c035fda9c4edbc6f772db9bdbf8751293f799b4/spotspot/__init__.py -------------------------------------------------------------------------------- /spotspot/services/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MattBlackOnly/SpotSpot/6c035fda9c4edbc6f772db9bdbf8751293f799b4/spotspot/services/__init__.py -------------------------------------------------------------------------------- /spotspot/services/config_service.py: -------------------------------------------------------------------------------- 1 | import os 2 | import json 3 | import logging 4 | import platform 5 | 6 | logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") 7 | 8 | 9 | class ConfigService: 10 | def __init__(self): 11 | self.get_vars() 12 | self.get_spotdl_vars() 13 | self.create_config_file() 14 | 15 | def get_vars(self): 16 | logging.info("Loading Environmental Variables...") 17 | 18 | os_system = platform.system() 19 | logging.info(f"OS: {os_system}") 20 | 21 | self.config_path = "D:\\config.json" if os_system == "Windows" else "/home/appuser/.spotdl/config.json" 22 | logging.info(f"Config file path: {self.config_path}") 23 | 24 | self.ffmpeg_location = "D:\\" if os_system == "Windows" else "/usr/bin/ffmpeg" 25 | logging.info(f"FFmpeg location set to: {self.ffmpeg_location}") 26 | 27 | self.track_output = os.getenv("TRACK_OUTPUT", "/data/media/music/singles/{artist} - {title}.{output-ext}") 28 | logging.info(f"Track Output: {self.track_output}") 29 | 30 | self.album_output = os.getenv("ALBUM_OUTPUT", "/data/media/music/{artist}/{album} - ({year})/{artist} - {title}.{output-ext}") 31 | logging.info(f"Album Output: {self.album_output}") 32 | 33 | self.playlist_output = os.getenv("PLAYLIST_OUTPUT", "/data/media/music/{list-name}/{artist} - {title}.{output-ext}") 34 | logging.info(f"Playlist Output: {self.playlist_output}") 35 | 36 | self.artist_output = os.getenv("ARTIST_OUTPUT", "/data/media/music/{artist}/{album} - ({year})/{artist} - {title}.{output-ext}") 37 | logging.info(f"Artist Output: {self.artist_output}") 38 | 39 | self.trigger_jellyfin_scan = os.getenv("TRIGGER_JELLYFIN_SCAN", "True") 40 | logging.info(f"Trigger Jellyfin Scan: {self.trigger_jellyfin_scan}") 41 | 42 | self.trigger_plex_scan = os.getenv("TRIGGER_PLEX_SCAN", "True") 43 | logging.info(f"Trigger Plex Scan: {self.trigger_plex_scan}") 44 | 45 | self.jellyfin_address = os.getenv("JELLYFIN_ADDRESS", "http://192.168.1.123:8096") 46 | logging.info(f"Jellyfin Address: {self.jellyfin_address}") 47 | 48 | self.jellyfin_api_key = os.getenv("JELLYFIN_API_KEY", "") 49 | logging.info(f"Jellyfin API Key entered: {self.jellyfin_api_key != ''}") 50 | 51 | self.plex_address = os.getenv("PLEX_ADDRESS", "http://192.168.1.123:32400") 52 | logging.info(f"Plex Address: {self.plex_address}") 53 | 54 | self.plex_token = os.getenv("PLEX_TOKEN", "") 55 | logging.info(f"Plex Token entered: {self.plex_token != ''}") 56 | 57 | self.plex_library_section_id = int(os.getenv("PLEX_LIBRARY_SECTION_ID", "1")) 58 | logging.info(f"Plex Library Section ID: {self.plex_library_section_id}") 59 | 60 | self.plex_library_name = os.getenv("PLEX_LIBRARY_NAME", "Music") 61 | logging.info(f"Plex Library Name: {self.plex_library_name}") 62 | 63 | self.plex_playlist_import_delay = float(os.getenv("PLEX_PLAYLIST_IMPORT_DELAY", "180")) 64 | logging.info(f"Plex Playlist Import Delay: {self.plex_playlist_import_delay}") 65 | 66 | self.generate_m3u_playlist = os.getenv("GENERATE_M3U_PLAYLIST", "True") 67 | logging.info(f"Generate M3U Playlist: {self.generate_m3u_playlist}") 68 | 69 | self.m3u_playlist_name = os.getenv("M3U_PLAYLIST_NAME", "spotify_singles") 70 | logging.info(f"Playlist Name: {self.m3u_playlist_name}") 71 | 72 | self.m3u_playlist_path = os.getenv("M3U_PLAYLIST_PATH", "/data/media/music/playlists") 73 | logging.info(f"Playlist Path: {self.m3u_playlist_path}") 74 | 75 | self.m3u_playlist_sort_order = os.getenv("M3U_PLAYLIST_SORT_ORDER", "date_desc") 76 | logging.info(f"Playlist Sort Order: {self.m3u_playlist_sort_order}") 77 | 78 | self.absolute_server_path = os.getenv("ABSOLUTE_SERVER_PATH", "/data/media/music/singles") 79 | logging.info(f"Absolute Server Path: {self.absolute_server_path}") 80 | 81 | self.supported_formats = {".mp3", ".flac", ".wav", ".aac", ".ogg", ".m4a", ".opus"} 82 | logging.info(f"Supported Formats: {self.supported_formats}") 83 | 84 | self.extra_logging = os.getenv("EXTRA_LOGGING", "False") 85 | logging.info(f"Extra Logging: {self.extra_logging}") 86 | 87 | self.search_limit = int(os.getenv("SEARCH_LIMIT", "10")) 88 | logging.info(f"Spotify Search Limit: {self.search_limit}") 89 | 90 | def get_spotdl_vars(self): 91 | logging.info("Loading SpotDL Environmental Variables...") 92 | 93 | self.client_id = os.getenv("CLIENT_ID", "5f573c9620494bae87890c0f08a60293") 94 | logging.info(f"Client ID entered: {self.client_id != ''}") 95 | 96 | self.client_secret = os.getenv("CLIENT_SECRET", "212476d9b0f3472eaa762d90b19b0ba8") 97 | logging.info(f"Client Secret entered: {self.client_secret != ''}") 98 | 99 | self.auth_token = os.getenv("AUTH_TOKEN", None) 100 | logging.info(f"Auth Token: {self.auth_token}") 101 | 102 | self.user_auth = os.getenv("USER_AUTH", "False").lower() == "true" 103 | logging.info(f"User Auth: {self.user_auth}") 104 | 105 | self.headless = os.getenv("HEADLESS", "False").lower() == "true" 106 | logging.info(f"Headless Mode: {self.headless}") 107 | 108 | self.cache_path = os.getenv("CACHE_PATH", "/home/appuser/.spotdl/.spotipy") 109 | logging.info(f"Cache Path: {self.cache_path}") 110 | 111 | self.no_cache = os.getenv("NO_CACHE", "True").lower() == "true" 112 | logging.info(f"No Cache: {self.no_cache}") 113 | 114 | self.output = os.getenv("OUTPUT", "{artists} - {title}.{output-ext}") 115 | logging.info(f"Output: {self.output}") 116 | 117 | self.format = os.getenv("FORMAT", "mp3") 118 | logging.info(f"Format: {self.format}") 119 | 120 | self.preload = os.getenv("PRELOAD", "False").lower() == "true" 121 | logging.info(f"Preload: {self.preload}") 122 | 123 | self.port = int(os.getenv("PORT", 8800)) 124 | logging.info(f"Port: {self.port}") 125 | 126 | self.host = os.getenv("HOST", "localhost") 127 | logging.info(f"Host: {self.host}") 128 | 129 | self.keep_alive = os.getenv("KEEP_ALIVE", "False").lower() == "true" 130 | logging.info(f"Keep Alive: {self.keep_alive}") 131 | 132 | self.enable_tls = os.getenv("ENABLE_TLS", "False").lower() == "true" 133 | logging.info(f"Enable TLS: {self.enable_tls}") 134 | 135 | self.proxy = os.getenv("PROXY", None) 136 | logging.info(f"Proxy: {self.proxy}") 137 | 138 | self.skip_explicit = os.getenv("SKIP_EXPLICIT", "False").lower() == "true" 139 | logging.info(f"Skip Explicit: {self.skip_explicit}") 140 | 141 | self.log_level = os.getenv("LOG_LEVEL", "DEBUG") 142 | logging.info(f"Log Level: {self.log_level}") 143 | 144 | self.restrict_mode = os.getenv("RESTRICT_MODE", "none") 145 | logging.info(f"Restrict Mode: {self.restrict_mode}") 146 | 147 | self.max_retries = int(os.getenv("MAX_RETRIES", 3)) 148 | logging.info(f"Max Retries: {self.max_retries}") 149 | 150 | self.use_cache_file = os.getenv("USE_CACHE_FILE", "False").lower() == "true" 151 | logging.info(f"Use Cache File: {self.use_cache_file}") 152 | 153 | self.audio_providers = os.getenv("AUDIO_PROVIDERS", "youtube-music").split(",") 154 | logging.info(f"Audio Providers: {self.audio_providers}") 155 | 156 | self.lyrics_providers = os.getenv("LYRICS_PROVIDERS", "genius,azlyrics,musixmatch").split(",") 157 | logging.info(f"Lyrics Providers: {self.lyrics_providers}") 158 | 159 | self.genious_token = os.getenv("GENIOUS_TOKEN", "alXXDbPZtK1m2RrZ8I4k2Hn8Ahsd0Gh_o076HYvcdlBvmc0ULL1H8Z8xRlew5qaG") 160 | logging.info(f"Genius Token Entered: {self.genious_token!=""}") 161 | 162 | self.playlist_numbering = os.getenv("PLAYLIST_NUMBERING", "False").lower() == "true" 163 | logging.info(f"Playlist Numbering: {self.playlist_numbering}") 164 | 165 | self.playlist_retain_track_cover = os.getenv("PLAYLIST_RETAIN_TRACK_COVER", "False").lower() == "true" 166 | logging.info(f"Playlist Retain Track Cover: {self.playlist_retain_track_cover}") 167 | 168 | self.scan_for_songs = os.getenv("SCAN_FOR_SONGS", "False").lower() == "true" 169 | logging.info(f"Scan for Songs: {self.scan_for_songs}") 170 | 171 | self.m3u = os.getenv("M3U", None) 172 | logging.info(f"M3U: {self.m3u}") 173 | 174 | self.overwrite = os.getenv("OVERWRITE", "skip") 175 | logging.info(f"Overwrite: {self.overwrite}") 176 | 177 | self.search_query = os.getenv("SEARCH_QUERY", None) 178 | logging.info(f"Search Query: {self.search_query}") 179 | 180 | self.ffmpeg = os.getenv("FFMPEG", "ffmpeg") 181 | logging.info(f"FFmpeg: {self.ffmpeg}") 182 | 183 | self.bitrate = os.getenv("BITRATE", None) 184 | logging.info(f"Bitrate: {self.bitrate}") 185 | 186 | self.ffmpeg_args = os.getenv("FFMPEG_ARGS", None) 187 | logging.info(f"FFmpeg Args: {self.ffmpeg_args}") 188 | 189 | self.save_file = os.getenv("SAVE_FILE", None) 190 | logging.info(f"Save File: {self.save_file}") 191 | 192 | self.filter_results = os.getenv("FILTER_RESULTS", "True").lower() == "true" 193 | logging.info(f"Filter Results: {self.filter_results}") 194 | 195 | self.threads = int(os.getenv("THREADS", 4)) 196 | logging.info(f"Threads: {self.threads}") 197 | 198 | self.cookie_file = os.getenv("COOKIE_FILE", None) 199 | logging.info(f"Cookie File: {self.cookie_file}") 200 | 201 | self.print_errors = os.getenv("PRINT_ERRORS", "False").lower() == "true" 202 | logging.info(f"Print Errors: {self.print_errors}") 203 | 204 | self.sponsor_block = os.getenv("SPONSOR_BLOCK", "False").lower() == "true" 205 | logging.info(f"Sponsor Block: {self.sponsor_block}") 206 | 207 | self.archive = os.getenv("ARCHIVE", None) 208 | logging.info(f"Archive: {self.archive}") 209 | 210 | self.load_config = os.getenv("LOAD_CONFIG", "True").lower() == "true" 211 | logging.info(f"Load Config: {self.load_config}") 212 | 213 | self.simple_tui = os.getenv("SIMPLE_TUI", "False").lower() == "true" 214 | logging.info(f"Simple TUI: {self.simple_tui}") 215 | 216 | self.fetch_albums = os.getenv("FETCH_ALBUMS", "False").lower() == "true" 217 | logging.info(f"Fetch Albums: {self.fetch_albums}") 218 | 219 | self.id3_separator = os.getenv("ID3_SEPARATOR", "/") 220 | logging.info(f"ID3 Separator: {self.id3_separator}") 221 | 222 | self.album_type = os.getenv("ALBUM_TYPE", None) 223 | logging.info(f"Album Type: {self.album_type}") 224 | 225 | self.restrict = os.getenv("RESTRICT", None) 226 | logging.info(f"Restrict: {self.restrict}") 227 | 228 | self.ytm_data = os.getenv("YTM_DATA", "False").lower() == "true" 229 | logging.info(f"YTM Data: {self.ytm_data}") 230 | 231 | self.add_unavailable = os.getenv("ADD_UNAVAILABLE", "False").lower() == "true" 232 | logging.info(f"Add Unavailable: {self.add_unavailable}") 233 | 234 | self.generate_lrc = os.getenv("GENERATE_LRC", "False").lower() == "true" 235 | logging.info(f"Generate LRC: {self.generate_lrc}") 236 | 237 | self.force_update_metadata = os.getenv("FORCE_UPDATE_METADATA", "False").lower() == "true" 238 | logging.info(f"Force Update Metadata: {self.force_update_metadata}") 239 | 240 | self.only_verified_results = os.getenv("ONLY_VERIFIED_RESULTS", "False").lower() == "true" 241 | logging.info(f"Only Verified Results: {self.only_verified_results}") 242 | 243 | self.sync_without_deleting = os.getenv("SYNC_WITHOUT_DELETING", "False").lower() == "true" 244 | logging.info(f"Sync Without Deleting: {self.sync_without_deleting}") 245 | 246 | self.max_filename_length = os.getenv("MAX_FILENAME_LENGTH", None) 247 | logging.info(f"Max Filename Length: {self.max_filename_length}") 248 | 249 | self.yt_dlp_args = os.getenv("YT_DLP_ARGS", None) 250 | logging.info(f"YT-DLP Args: {self.yt_dlp_args}") 251 | 252 | self.detect_formats = os.getenv("DETECT_FORMATS", None) 253 | logging.info(f"Detect Formats: {self.detect_formats}") 254 | 255 | self.save_errors = os.getenv("SAVE_ERRORS", None) 256 | logging.info(f"Save Errors: {self.save_errors}") 257 | 258 | self.ignore_albums = os.getenv("IGNORE_ALBUMS", None) 259 | logging.info(f"Ignore Albums: {self.ignore_albums}") 260 | 261 | self.log_format = os.getenv("LOG_FORMAT", None) 262 | logging.info(f"Log Format: {self.log_format}") 263 | 264 | self.redownload = os.getenv("REDOWNLOAD", "False").lower() == "true" 265 | logging.info(f"Redownload: {self.redownload}") 266 | 267 | self.skip_album_art = os.getenv("SKIP_ALBUM_ART", "False").lower() == "true" 268 | logging.info(f"Skip Album Art: {self.skip_album_art}") 269 | 270 | self.create_skip_file = os.getenv("CREATE_SKIP_FILE", "False").lower() == "true" 271 | logging.info(f"Create Skip File: {self.create_skip_file}") 272 | 273 | self.respect_skip_file = os.getenv("RESPECT_SKIP_FILE", "False").lower() == "true" 274 | logging.info(f"Respect Skip File: {self.respect_skip_file}") 275 | 276 | self.sync_remove_lrc = os.getenv("SYNC_REMOVE_LRC", "False").lower() == "true" 277 | logging.info(f"Sync Remove LRC: {self.sync_remove_lrc}") 278 | 279 | self.web_use_output_dir = os.getenv("WEB_USE_OUTPUT_DIR", "False").lower() == "true" 280 | logging.info(f"Web Use Output Dir: {self.web_use_output_dir}") 281 | 282 | self.key_file = os.getenv("KEY_FILE", None) 283 | logging.info(f"Key File: {self.key_file}") 284 | 285 | self.cert_file = os.getenv("CERT_FILE", None) 286 | logging.info(f"Cert File: {self.cert_file}") 287 | 288 | self.ca_file = os.getenv("CA_FILE", None) 289 | logging.info(f"CA File: {self.ca_file}") 290 | 291 | self.allowed_origins = os.getenv("ALLOWED_ORIGINS", None) 292 | logging.info(f"Allowed Origins: {self.allowed_origins}") 293 | 294 | self.keep_sessions = os.getenv("KEEP_SESSIONS", "False").lower() == "true" 295 | logging.info(f"Keep Sessions: {self.keep_sessions}") 296 | 297 | self.force_update_gui = os.getenv("FORCE_UPDATE_GUI", "False").lower() == "true" 298 | logging.info(f"Force Update GUI: {self.force_update_gui}") 299 | 300 | self.web_gui_repo = os.getenv("WEB_GUI_REPO", None) 301 | logging.info(f"Web GUI Repo: {self.web_gui_repo}") 302 | 303 | self.web_gui_location = os.getenv("WEB_GUI_LOCATION", None) 304 | logging.info(f"Web GUI Location: {self.web_gui_location}") 305 | 306 | # Create the spotdl_config dictionary 307 | self.spotdl_config = { 308 | "client_id": self.client_id, 309 | "client_secret": self.client_secret, 310 | "auth_token": self.auth_token, 311 | "user_auth": self.user_auth, 312 | "headless": self.headless, 313 | "cache_path": self.cache_path, 314 | "no_cache": self.no_cache, 315 | "max_retries": self.max_retries, 316 | "use_cache_file": self.use_cache_file, 317 | "audio_providers": self.audio_providers, 318 | "lyrics_providers": self.lyrics_providers, 319 | "genius_token": self.genious_token, 320 | "playlist_numbering": self.playlist_numbering, 321 | "playlist_retain_track_cover": self.playlist_retain_track_cover, 322 | "scan_for_songs": self.scan_for_songs, 323 | "m3u": self.m3u, 324 | "output": self.output, 325 | "overwrite": self.overwrite, 326 | "search_query": self.search_query, 327 | "ffmpeg": self.ffmpeg, 328 | "bitrate": self.bitrate, 329 | "ffmpeg_args": self.ffmpeg_args, 330 | "format": self.format, 331 | "save_file": self.save_file, 332 | "filter_results": self.filter_results, 333 | "threads": self.threads, 334 | "cookie_file": self.cookie_file, 335 | "print_errors": self.print_errors, 336 | "sponsor_block": self.sponsor_block, 337 | "preload": self.preload, 338 | "archive": self.archive, 339 | "load_config": self.load_config, 340 | "log_level": self.log_level, 341 | "simple_tui": self.simple_tui, 342 | "fetch_albums": self.fetch_albums, 343 | "album_type": self.album_type, 344 | "restrict": self.restrict, 345 | "id3_separator": self.id3_separator, 346 | "ytm_data": self.ytm_data, 347 | "add_unavailable": self.add_unavailable, 348 | "generate_lrc": self.generate_lrc, 349 | "force_update_metadata": self.force_update_metadata, 350 | "only_verified_results": self.only_verified_results, 351 | "sync_without_deleting": self.sync_without_deleting, 352 | "max_filename_length": self.max_filename_length, 353 | "yt_dlp_args": self.yt_dlp_args, 354 | "detect_formats": self.detect_formats, 355 | "save_errors": self.save_errors, 356 | "ignore_albums": self.ignore_albums, 357 | "proxy": self.proxy, 358 | "skip_explicit": self.skip_explicit, 359 | "log_format": self.log_format, 360 | "redownload": self.redownload, 361 | "skip_album_art": self.skip_album_art, 362 | "create_skip_file": self.create_skip_file, 363 | "respect_skip_file": self.respect_skip_file, 364 | "sync_remove_lrc": self.sync_remove_lrc, 365 | "web_use_output_dir": self.web_use_output_dir, 366 | "port": self.port, 367 | "host": self.host, 368 | "keep_alive": self.keep_alive, 369 | "enable_tls": self.enable_tls, 370 | "key_file": self.key_file, 371 | "cert_file": self.cert_file, 372 | "ca_file": self.ca_file, 373 | "allowed_origins": self.allowed_origins, 374 | "keep_sessions": self.keep_sessions, 375 | "force_update_gui": self.force_update_gui, 376 | "web_gui_repo": self.web_gui_repo, 377 | "web_gui_location": self.web_gui_location, 378 | } 379 | 380 | def create_config_file(self): 381 | try: 382 | os.makedirs(os.path.dirname(self.config_path), exist_ok=True) 383 | with open(self.config_path, "w", encoding="utf-8") as config_file: 384 | json.dump(self.spotdl_config, config_file, indent=4) 385 | logging.info(f"Configuration saved to {self.config_path}") 386 | except Exception as e: 387 | logging.error(f"Failed to save config file: {e}") 388 | -------------------------------------------------------------------------------- /spotspot/services/download_service.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import logging 3 | import subprocess 4 | 5 | logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") 6 | 7 | 8 | class DownloadService: 9 | def __init__(self, config, playlist_manager, socketio, download_queue, download_history): 10 | self.config = config 11 | self.playlist_manager = playlist_manager 12 | self.socketio = socketio 13 | self.download_queue = download_queue 14 | self.download_history = download_history 15 | self.spodtdl_subprocess = None 16 | 17 | def add_item_to_queue(self, data): 18 | logging.info(f"Download Requested: {data}") 19 | 20 | spotify_url = data.get("url") 21 | item_type = data.get("type") 22 | item_name = data.get("name") 23 | item_artist = data.get("artist") 24 | 25 | download_info = {"name": item_name, "type": item_type, "artist": item_artist, "url": spotify_url, "status": "Pending..."} 26 | 27 | self.download_queue.put((spotify_url, download_info)) 28 | self.download_history[spotify_url] = download_info 29 | 30 | self.socketio.emit("update_status", {"history": list(self.download_history.values())}) 31 | 32 | def process_downloads(self): 33 | while True: 34 | url, download_info = self.download_queue.get() 35 | 36 | if download_info["status"] == "Cancelled": 37 | self.download_queue.task_done() 38 | continue 39 | 40 | if download_info["type"] == "track": 41 | download_path = self.config.track_output 42 | elif download_info["type"] == "playlist": 43 | download_path = self.config.playlist_output 44 | elif download_info["type"] == "album": 45 | download_path = self.config.album_output 46 | elif download_info["type"] == "artist": 47 | download_path = self.config.artist_output 48 | 49 | download_info["status"] = "Downloading..." 50 | self.download_history[url] = download_info 51 | self.socketio.emit("update_status", {"history": list(self.download_history.values())}) 52 | 53 | try: 54 | logging.info(f"Downloading: {url}") 55 | 56 | command = ["spotdl", "--output", f"{download_path}", url] 57 | logging.info(f"SpotDL command: {command}") 58 | 59 | self.spodtdl_subprocess = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) 60 | 61 | if self.config.extra_logging.lower() == "false": 62 | stdout, stderr = self.spodtdl_subprocess.communicate() 63 | else: 64 | while True and self.config.extra_logging.lower() == "true": 65 | stdout_line = self.spodtdl_subprocess.stdout.readline() 66 | stderr_line = self.spodtdl_subprocess.stderr.readline() 67 | 68 | if stdout_line: 69 | logging.info(f"SpotDL Output: {stdout_line.strip()}") 70 | sys.stdout.flush() 71 | 72 | if stderr_line: 73 | logging.error(f"SpotDL Error Log: {stderr_line.strip()}") 74 | sys.stderr.flush() 75 | 76 | if stdout_line == "" and stderr_line == "" and self.spodtdl_subprocess.poll() is not None: 77 | logging.info(f"No more SpotDL Logs available") 78 | break 79 | 80 | if download_info["status"] == "Cancelled": 81 | self.download_queue.task_done() 82 | continue 83 | 84 | if self.spodtdl_subprocess.returncode == 0: 85 | download_info["status"] = "Complete" 86 | logging.info(f"Finished Item") 87 | else: 88 | download_info["status"] = "Failed" 89 | logging.error(f"Error downloading: {stderr}") 90 | 91 | self.download_history[url] = download_info 92 | 93 | except Exception as e: 94 | logging.error(f"Process Downloads Error: {str(e)}") 95 | download_info["status"] = "Error" 96 | self.download_history[url] = download_info 97 | 98 | self.socketio.emit("update_status", {"history": list(self.download_history.values())}) 99 | 100 | self.download_queue.task_done() 101 | 102 | if self.download_queue.empty(): 103 | logging.info("Queue is empty") 104 | self.playlist_manager.media_server_refresh_check() 105 | 106 | def cancel_active_download(self): 107 | try: 108 | if not self.spodtdl_subprocess: 109 | logging.info(f"No active download.") 110 | return 111 | 112 | logging.info(f"Cancelling active download.") 113 | self.spodtdl_subprocess.terminate() 114 | 115 | # Find the active download in history and update its status 116 | for url, info in self.download_history.items(): 117 | if info["status"] == "Downloading...": 118 | info["status"] = "Cancelled" 119 | self.download_history[url] = info 120 | break 121 | 122 | self.spodtdl_subprocess = None 123 | 124 | except Exception as e: 125 | logging.error(f"Cancel Active Error: {str(e)}") 126 | 127 | finally: 128 | self.socketio.emit("update_status", {"history": list(self.download_history.values())}) 129 | 130 | def cancel_pending_downloads(self): 131 | try: 132 | temp_queue = [] 133 | while not self.download_queue.empty(): 134 | url, download_info = self.download_queue.get() 135 | download_info["status"] = "Cancelled" 136 | self.download_history[url] = download_info 137 | temp_queue.append((url, download_info)) 138 | 139 | for item in temp_queue: 140 | self.download_queue.put(item) 141 | 142 | except Exception as e: 143 | logging.error(f"Cancel Pending Error: {str(e)}") 144 | 145 | finally: 146 | self.socketio.emit("update_status", {"history": list(self.download_history.values())}) 147 | -------------------------------------------------------------------------------- /spotspot/services/playlist_manager.py: -------------------------------------------------------------------------------- 1 | import os 2 | import logging 3 | import requests 4 | import threading 5 | from plexapi.server import PlexServer 6 | 7 | logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") 8 | 9 | 10 | class PlaylistManager: 11 | def __init__(self, config): 12 | self.config = config 13 | 14 | def generate_m3u_playlist(self): 15 | try: 16 | folder_path = self.config.absolute_server_path 17 | logging.info(f"Generating M3U playlist for folder: {folder_path}") 18 | 19 | # Ensure playlist directory exists 20 | os.makedirs(self.config.m3u_playlist_path, exist_ok=True) 21 | 22 | m3u_file_path = os.path.join(self.config.m3u_playlist_path, f"{self.config.m3u_playlist_name}.m3u") 23 | logging.info(f"M3U playlist file: {m3u_file_path}") 24 | 25 | # Get list of files with their modification times 26 | files = [] 27 | for file in os.listdir(folder_path): 28 | file_path = os.path.join(folder_path, file) 29 | if os.path.isfile(file_path) and any(file.lower().endswith(ext) for ext in self.config.supported_formats): 30 | files.append((file_path, file, os.path.getmtime(file_path))) 31 | 32 | # Apply sorting based on environment variable 33 | if self.config.m3u_playlist_sort_order == "name_asc": 34 | files.sort(key=lambda x: x[1]) 35 | elif self.config.m3u_playlist_sort_order == "name_desc": 36 | files.sort(key=lambda x: x[1], reverse=True) 37 | elif self.config.m3u_playlist_sort_order == "date_asc": 38 | files.sort(key=lambda x: x[2]) 39 | else: 40 | files.sort(key=lambda x: x[2], reverse=True) 41 | 42 | # Write sorted files to M3U playlist 43 | with open(m3u_file_path, "w") as m3u_file: 44 | for file_path, _, _ in files: 45 | m3u_file.write(f"{file_path}\n") 46 | 47 | logging.info(f"M3U playlist generated at: {m3u_file_path}") 48 | 49 | except Exception as e: 50 | logging.error(f"Playlist Generation Error: {str(e)}") 51 | 52 | def refresh_plex_library(self): 53 | try: 54 | logging.info("Refreshing Plex library...") 55 | plex_server = PlexServer(self.config.plex_address, self.config.plex_token) 56 | library_section = plex_server.library.section(self.config.plex_library_name) 57 | library_section.update() 58 | logging.info(f"Plex Library scan for '{self.config.plex_library_name}' started.") 59 | 60 | except Exception as e: 61 | logging.error(f"Plex scan error: {str(e)}") 62 | 63 | def refresh_jellyfin_library(self): 64 | try: 65 | logging.info("Refreshing Jellyfin library...") 66 | url = f"{self.config.jellyfin_address}/Library/Refresh?api_key={self.config.jellyfin_api_key}" 67 | response = requests.post(url) 68 | 69 | if response.status_code == 204: 70 | logging.info("Jellyfin library refreshed successfully.") 71 | else: 72 | logging.error(f"Failed to refresh Jellyfin library: {response.status_code} - {response.text}") 73 | 74 | except Exception as e: 75 | logging.error(f"Jellyfin scan error: {str(e)}") 76 | 77 | def import_playlist_to_plex(self): 78 | try: 79 | logging.info(f"Starting Plex Playlist Import") 80 | plex_m3u_file_path = os.path.join(self.config.m3u_playlist_path, f"{self.config.m3u_playlist_name}.m3u") 81 | logging.info(f"Plex Playlist Path: {plex_m3u_file_path}") 82 | 83 | url = f"{self.config.plex_address}/playlists/upload?sectionID={self.config.plex_library_section_id}&path={plex_m3u_file_path}&X-Plex-Token={self.config.plex_token}" 84 | 85 | response = requests.post(url) 86 | if response.status_code == 200: 87 | logging.info(f"Plex Playlist Imported Successfully: {plex_m3u_file_path}") 88 | else: 89 | logging.error(f"Plex Playlist Failed to Import: {plex_m3u_file_path}. Status Code: {str(response.status_code)}") 90 | 91 | except Exception as e: 92 | logging.error(f"Plex Playlist Import Error: {str(e)}") 93 | 94 | def media_server_refresh_check(self): 95 | # Refresh Library to pick up new files 96 | if self.config.trigger_jellyfin_scan.lower() == "true": 97 | self.refresh_jellyfin_library() 98 | if self.config.trigger_plex_scan.lower() == "true": 99 | self.refresh_plex_library() 100 | 101 | # Generate/Update Playlist 102 | if self.config.generate_m3u_playlist.lower() == "true": 103 | logging.info("M3U Playlist Generation started...") 104 | self.generate_m3u_playlist() 105 | 106 | # Refresh Library to pick up playlist 107 | if self.config.trigger_jellyfin_scan.lower() == "true": 108 | self.refresh_jellyfin_library() 109 | if self.config.trigger_plex_scan.lower() == "true": 110 | logging.info(f"Delaying Plex Playlist Import for {self.config.plex_playlist_import_delay} seconds") 111 | threading.Timer(self.config.plex_playlist_import_delay, self.import_playlist_to_plex).start() 112 | -------------------------------------------------------------------------------- /spotspot/services/spotfiy_service.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import spotipy 3 | from spotipy.oauth2 import SpotifyClientCredentials 4 | 5 | logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") 6 | 7 | 8 | class SpotifyService: 9 | def __init__(self, config): 10 | self.config = config 11 | 12 | def perform_spotify_search(self, search_req): 13 | try: 14 | parsed_results = None 15 | query_type = search_req.get("type", "track") 16 | query = search_req.get("query") 17 | search_type = "album,artist,playlist,track" if query_type == "all" else query_type 18 | 19 | logging.info(f"Search query: {query}, Type: {search_type}") 20 | client_credentials_manager = SpotifyClientCredentials(client_id=self.config.client_id, client_secret=self.config.client_secret) 21 | self.sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager) 22 | 23 | results = self.sp.search(q=query, limit=self.config.search_limit, type=search_type) 24 | parsed_results = self.parse_spotify_data(results) 25 | 26 | except Exception as e: 27 | logging.error(f"Spotify Search Error: {str(e)}") 28 | 29 | finally: 30 | return parsed_results 31 | 32 | def parse_spotify_data(self, results): 33 | parsed_results = {"tracks": [], "albums": [], "artists": [], "playlists": []} 34 | 35 | # Parsing tracks from the search results 36 | if "tracks" in results: 37 | for item in results["tracks"]["items"]: 38 | parsed_results["tracks"].append( 39 | { 40 | "type": "track", 41 | "name": item["name"], 42 | "artist": item["artists"][0]["name"], 43 | "album": item["album"]["name"], 44 | "url": item["external_urls"]["spotify"], 45 | "image": item["album"]["images"][0]["url"] if item["album"]["images"] else None, 46 | } 47 | ) 48 | 49 | # Parsing albums from the search results 50 | if "albums" in results: 51 | for item in results["albums"]["items"]: 52 | parsed_results["albums"].append( 53 | { 54 | "type": "album", 55 | "name": item["name"], 56 | "artist": item["artists"][0]["name"], 57 | "release_date": item["release_date"], 58 | "url": item["external_urls"]["spotify"], 59 | "image": item["images"][0]["url"] if item["images"] else None, 60 | } 61 | ) 62 | 63 | # Parsing artists from the search results 64 | if "artists" in results: 65 | for item in results["artists"]["items"]: 66 | parsed_results["artists"].append( 67 | { 68 | "type": "artist", 69 | "name": item["name"], 70 | "followers": item["followers"]["total"], 71 | "url": item["external_urls"]["spotify"], 72 | "image": item["images"][0]["url"] if item["images"] else None, 73 | } 74 | ) 75 | 76 | # Parsing playlists from the search results 77 | if "playlists" in results: 78 | for item in results["playlists"]["items"]: 79 | if not item: 80 | continue 81 | parsed_results["playlists"].append( 82 | { 83 | "type": "playlist", 84 | "name": item["name"], 85 | "owner": item["owner"]["display_name"], 86 | "url": item["external_urls"]["spotify"], 87 | "image": item["images"][0]["url"] if item["images"] else None, 88 | } 89 | ) 90 | 91 | return {key: value for key, value in parsed_results.items() if value} 92 | -------------------------------------------------------------------------------- /spotspot/spotspot.py: -------------------------------------------------------------------------------- 1 | import queue 2 | import logging 3 | import threading 4 | from flask_socketio import SocketIO 5 | from flask import Flask, render_template 6 | from services.config_service import ConfigService 7 | from services.spotfiy_service import SpotifyService 8 | from services.download_service import DownloadService 9 | from services.playlist_manager import PlaylistManager 10 | 11 | logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") 12 | 13 | 14 | class SpotSpotWebApp: 15 | def __init__(self): 16 | # Setup Flask App 17 | self.app = Flask(__name__) 18 | self.app.secret_key = "SECRET_KEY" 19 | self.socketio = SocketIO(self.app) 20 | # Setup Data 21 | self.download_queue = queue.Queue() 22 | self.download_history = {} 23 | self.active_downloads = {} 24 | # Instantiate 25 | self.config = ConfigService() 26 | self.spotify_services = SpotifyService(self.config) 27 | self.playlist_manager = PlaylistManager(self.config) 28 | self.download_services = DownloadService(self.config, self.playlist_manager, self.socketio, self.download_queue, self.download_history) 29 | # Setup Routes 30 | self.setup_routes() 31 | self.start_download_thread() 32 | 33 | def setup_routes(self): 34 | @self.app.route("/") 35 | def index_page(): 36 | return render_template("index.html") 37 | 38 | @self.app.route("/status") 39 | def status_page(): 40 | return render_template("status.html") 41 | 42 | @self.socketio.on("search") 43 | def handle_search(query_req): 44 | if not query_req.get("query"): 45 | self.socketio.emit("toast", {"title": "Blank Search Query", "body": "Please enter search request"}) 46 | parsed_results = {} 47 | else: 48 | parsed_results = self.spotify_services.perform_spotify_search(query_req) 49 | self.socketio.emit("search_results", {"results": parsed_results}) 50 | 51 | @self.socketio.on("download_item") 52 | def handle_download(requested_item): 53 | self.download_services.add_item_to_queue(requested_item) 54 | 55 | @self.socketio.on("get_status") 56 | def handle_get_status(): 57 | self.socketio.emit("update_status", {"history": list(self.download_history.values())}) 58 | 59 | @self.socketio.on("cancel_all") 60 | def cancel_all(): 61 | logging.info(f"Request to cancel all download recieved") 62 | self.download_services.cancel_active_download() 63 | self.download_services.cancel_pending_downloads() 64 | 65 | @self.socketio.on("cancel_active") 66 | def cancel_active(): 67 | logging.info(f"Request to cancel active download recieved") 68 | self.download_services.cancel_active_download() 69 | 70 | def start_download_thread(self): 71 | download_thread = threading.Thread(target=self.download_services.process_downloads, daemon=True) 72 | download_thread.start() 73 | 74 | def run_app(self): 75 | self.socketio.run(self.app, host="0.0.0.0", port=5000) 76 | 77 | def get_app(self): 78 | return self.app 79 | 80 | 81 | spotspot_web_app = SpotSpotWebApp() 82 | 83 | if __name__ == "__main__": 84 | spotspot_web_app.run_app() 85 | else: 86 | app = spotspot_web_app.get_app() 87 | -------------------------------------------------------------------------------- /spotspot/static/full-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MattBlackOnly/SpotSpot/6c035fda9c4edbc6f772db9bdbf8751293f799b4/spotspot/static/full-logo.png -------------------------------------------------------------------------------- /spotspot/static/js_general_script.js: -------------------------------------------------------------------------------- 1 | const socket = io(); 2 | const searchButton = document.getElementById('search-button'); 3 | const spinnerBorder = document.getElementById('spinner-border'); 4 | const searchInput = document.getElementById('search-input'); 5 | const searchDropdown = document.getElementById('search-dropdown'); 6 | let selectedType = "track"; 7 | 8 | function changeUI(reqState) { 9 | if (reqState === "busy") { 10 | searchInput.disabled = true; 11 | searchButton.disabled = true; 12 | searchDropdown.disabled = true; 13 | spinnerBorder.style.display = 'inline-block'; 14 | } else { 15 | spinnerBorder.style.display = 'none'; 16 | searchInput.disabled = false; 17 | searchButton.disabled = false; 18 | searchDropdown.disabled = false; 19 | } 20 | } 21 | 22 | function updateSelection(option) { 23 | selectedType = option.toLowerCase(); 24 | document.getElementById("search-button").innerText = `Search for ${option}`; 25 | } 26 | 27 | function initiateSearch() { 28 | changeUI("busy"); 29 | const searchText = searchInput.value; 30 | socket.emit('search', { query: searchText, type: selectedType }); 31 | } 32 | 33 | function populateTemplate(type, data) { 34 | let templateId; 35 | let element; 36 | 37 | if (type === 'track') { 38 | templateId = 'track-item-template'; 39 | } else if (type === 'album') { 40 | templateId = 'album-item-template'; 41 | } else if (type === 'artist') { 42 | templateId = 'artist-item-template'; 43 | } else if (type === 'playlist') { 44 | templateId = 'playlist-item-template'; 45 | } 46 | 47 | const template = document.getElementById(templateId); 48 | const clone = document.importNode(template.content, true); 49 | 50 | const downloadButton = clone.querySelector('.download'); 51 | 52 | if (type === 'track') { 53 | clone.querySelector('.track-img').src = data.image || 'https://picsum.photos/300'; 54 | clone.querySelector('.name').textContent = data.name; 55 | clone.querySelector('.artist').textContent = data.artist; 56 | clone.querySelector('.download').href = data.url; 57 | clone.querySelector('.download').setAttribute('data-url', data.url); 58 | } else if (type === 'album') { 59 | clone.querySelector('.album-img').src = data.image || 'https://picsum.photos/300'; 60 | clone.querySelector('.name').textContent = data.name; 61 | clone.querySelector('.artist').textContent = data.artist; 62 | clone.querySelector('.download').href = data.url; 63 | clone.querySelector('.download').setAttribute('data-url', data.url); 64 | } else if (type === 'artist') { 65 | clone.querySelector('.artist-img').src = data.image || 'https://picsum.photos/300'; 66 | clone.querySelector('.name').textContent = data.name; 67 | clone.querySelector('.followers').textContent = `${data.followers} Followers`; 68 | clone.querySelector('.download').href = data.url; 69 | clone.querySelector('.download').setAttribute('data-url', data.url); 70 | } else if (type === 'playlist') { 71 | clone.querySelector('.playlist-img').src = data.image || 'https://picsum.photos/300'; 72 | clone.querySelector('.name').textContent = data.name; 73 | clone.querySelector('.owner').textContent = data.owner; 74 | clone.querySelector('.download').href = data.url; 75 | clone.querySelector('.download').setAttribute('data-url', data.url); 76 | } 77 | 78 | element = document.getElementById('results-section'); 79 | element.appendChild(clone); 80 | 81 | downloadButton.addEventListener('click', function (event) { 82 | event.preventDefault(); 83 | handleDownloadClick(event); 84 | }); 85 | } 86 | 87 | function handleDownloadClick(event) { 88 | const button = event.target; 89 | 90 | button.disabled = true; 91 | button.classList.remove('btn-primary'); 92 | button.classList.add('btn-secondary'); 93 | button.classList.add('disabled'); 94 | button.innerText = 'Added'; 95 | 96 | const trackUrl = button.getAttribute('data-url'); 97 | const card = button.closest('.card'); 98 | 99 | if (!trackUrl) { 100 | alert('No URL found!'); 101 | return; 102 | } 103 | 104 | const itemData = { 105 | type: card.querySelector('.type')?.textContent.trim().toLowerCase(), 106 | name: card.querySelector('.name')?.textContent.trim(), 107 | artist: card.querySelector('.artist')?.textContent.trim() || null, 108 | url: trackUrl 109 | }; 110 | 111 | socket.emit('download_item', itemData); 112 | } 113 | 114 | searchInput.addEventListener('keydown', function (event) { 115 | if (event.key === 'Enter') { 116 | event.preventDefault(); 117 | initiateSearch(); 118 | } 119 | }); 120 | 121 | searchButton.addEventListener('click', initiateSearch); 122 | 123 | socket.on('search_results', function (data) { 124 | changeUI("ready"); 125 | const resultsSection = document.getElementById('results-section'); 126 | resultsSection.innerHTML = ''; 127 | 128 | if (data && data.results) { 129 | for (let category in data.results) { 130 | let items = data.results[category]; 131 | 132 | if (Array.isArray(items) && items.length > 0) { 133 | items.forEach(item => { 134 | populateTemplate(item.type, item); 135 | }); 136 | } else { 137 | const noResultsMessage = document.createElement('p'); 138 | noResultsMessage.textContent = 'No results found'; 139 | resultsSection.appendChild(noResultsMessage); 140 | } 141 | } 142 | } 143 | }); 144 | -------------------------------------------------------------------------------- /spotspot/static/js_status_script.js: -------------------------------------------------------------------------------- 1 | const socket = io(); 2 | const cancelActive = document.getElementById('cancel-active-button'); 3 | const cancelAll = document.getElementById('cancel-all-button'); 4 | 5 | window.onload = function () { 6 | socket.emit("get_status"); 7 | }; 8 | 9 | socket.on("update_status", function (data) { 10 | const historyContainer = document.getElementById("history-body"); 11 | historyContainer.innerHTML = ""; 12 | 13 | if (data.history.length === 0) { 14 | document.getElementById("no-downloads-msg").style.display = "block"; 15 | } else { 16 | document.getElementById("no-downloads-msg").style.display = "none"; 17 | data.history.forEach(function (item) { 18 | const row = document.createElement("tr"); 19 | 20 | const nameCell = document.createElement("td"); 21 | nameCell.textContent = item.name; 22 | row.appendChild(nameCell); 23 | 24 | const typeCell = document.createElement("td"); 25 | typeCell.textContent = item.type; 26 | row.appendChild(typeCell); 27 | 28 | const artistCell = document.createElement("td"); 29 | artistCell.textContent = item.artist; 30 | row.appendChild(artistCell); 31 | 32 | const urlCell = document.createElement("td"); 33 | const urlLink = document.createElement("a"); 34 | urlLink.href = item.url; 35 | urlLink.textContent = item.url; 36 | urlLink.target = "_blank"; 37 | urlCell.appendChild(urlLink); 38 | row.appendChild(urlCell); 39 | 40 | const statusCell = document.createElement("td"); 41 | statusCell.textContent = item.status; 42 | row.appendChild(statusCell); 43 | 44 | historyContainer.appendChild(row); 45 | }); 46 | } 47 | }); 48 | 49 | cancelActive.addEventListener('click', function () { 50 | socket.emit("cancel_active"); 51 | }); 52 | 53 | cancelAll.addEventListener('click', function () { 54 | socket.emit("cancel_all"); 55 | }); 56 | -------------------------------------------------------------------------------- /spotspot/static/js_theme_switcher.js: -------------------------------------------------------------------------------- 1 | const dayButton = document.getElementById('dayMode'); 2 | const autoButton = document.getElementById('autoMode'); 3 | const nightButton = document.getElementById('nightMode'); 4 | const storedTheme = localStorage.getItem('theme'); 5 | const storedMode = localStorage.getItem('mode'); 6 | 7 | if (storedMode === 'auto') { 8 | setTheme(getSystemTheme()); 9 | } else { 10 | setTheme(storedTheme || 'light'); 11 | } 12 | 13 | function setTheme(theme) { 14 | document.documentElement.setAttribute('data-bs-theme', theme); 15 | 16 | const body = document.body; 17 | if (theme === 'light') { 18 | body.classList.add('bg-body-tertiary'); 19 | } else if (theme === 'dark') { 20 | body.classList.remove('bg-body-tertiary'); 21 | } 22 | 23 | dayButton.classList.toggle('active', theme === 'light' && localStorage.getItem('mode') === 'manual'); 24 | autoButton.classList.toggle('active', localStorage.getItem('mode') === 'auto'); 25 | nightButton.classList.toggle('active', theme === 'dark' && localStorage.getItem('mode') === 'manual'); 26 | } 27 | 28 | function getSystemTheme() { 29 | return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; 30 | } 31 | 32 | window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => { 33 | if (localStorage.getItem('mode') === 'auto') { 34 | setTheme(getSystemTheme()); 35 | } 36 | }); 37 | 38 | dayButton.addEventListener('click', () => { 39 | localStorage.setItem('theme', 'light'); 40 | localStorage.setItem('mode', 'manual'); 41 | setTheme('light'); 42 | }); 43 | 44 | nightButton.addEventListener('click', () => { 45 | localStorage.setItem('theme', 'dark'); 46 | localStorage.setItem('mode', 'manual'); 47 | setTheme('dark'); 48 | }); 49 | 50 | autoButton.addEventListener('click', () => { 51 | localStorage.setItem('mode', 'auto'); 52 | setTheme(getSystemTheme()); 53 | }); 54 | 55 | socket.on("toast", function (data) { 56 | document.getElementById('toast-title').innerText = data.title; 57 | document.getElementById('toast-message').innerText = data.body; 58 | document.getElementById('toast-time').innerText = new Date().toLocaleTimeString(); 59 | 60 | var toastElement = document.getElementById('toast'); 61 | var toast = new bootstrap.Toast(toastElement); 62 | toast.show(); 63 | }); 64 | -------------------------------------------------------------------------------- /spotspot/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MattBlackOnly/SpotSpot/6c035fda9c4edbc6f772db9bdbf8751293f799b4/spotspot/static/logo.png -------------------------------------------------------------------------------- /spotspot/static/phone-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MattBlackOnly/SpotSpot/6c035fda9c4edbc6f772db9bdbf8751293f799b4/spotspot/static/phone-screenshot.png -------------------------------------------------------------------------------- /spotspot/static/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MattBlackOnly/SpotSpot/6c035fda9c4edbc6f772db9bdbf8751293f799b4/spotspot/static/screenshot.png -------------------------------------------------------------------------------- /spotspot/static/spotspot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MattBlackOnly/SpotSpot/6c035fda9c4edbc6f772db9bdbf8751293f799b4/spotspot/static/spotspot.png -------------------------------------------------------------------------------- /spotspot/static/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | } 5 | 6 | .container { 7 | max-width: 85% !important; 8 | } 9 | 10 | ::-webkit-scrollbar { 11 | width: 12px; 12 | } 13 | 14 | ::-webkit-scrollbar-track { 15 | background: #ffffff; 16 | border-radius: 10px; 17 | } 18 | 19 | ::-webkit-scrollbar-thumb { 20 | background: #007bffa4; 21 | border-radius: 10px; 22 | } 23 | 24 | ::-webkit-scrollbar-thumb:hover { 25 | background: #007bff; 26 | } 27 | 28 | ::-webkit-scrollbar-corner { 29 | background: #f1f1f1; 30 | } 31 | 32 | @media screen and (max-width: 600px) { 33 | .container { 34 | max-width: 99% !important; 35 | } 36 | 37 | #history-table th:nth-child(4), 38 | #history-table td:nth-child(4) { 39 | display: none; 40 | } 41 | } -------------------------------------------------------------------------------- /spotspot/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | SpotSpot 8 | 10 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 |
25 |
26 | 27 | 28 | 29 |
30 |

SpotSpot

31 |
32 | 33 | 34 |
35 |
36 | 38 | 43 | 47 | 54 |
55 |
56 | 57 | 58 |
59 | 60 |
61 |
62 | 63 | 77 | 78 | 79 | 92 | 93 | 94 | 107 | 108 | 109 | 122 | 123 | 124 |
125 |
126 | 127 | 137 |
138 |
139 | 140 | 141 | 142 |
143 |
144 |
145 | 149 | 153 | 157 |
158 |
159 |
160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /spotspot/templates/status.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | SpotSpot 8 | 10 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |
24 |
25 | 26 | 27 | 28 |
29 |

SpotSpot

30 | 31 |
32 |
33 |

Download History

34 |
35 |
36 |
37 | 39 | 41 |
42 |
43 |
44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 |
NameTypeArtistURLStatus
57 |

No recent downloads.

58 |
59 | 60 |
61 | 62 | 63 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ASCII Art 4 | echo "-----------------------------------------------------------" 5 | echo " SSSSS PPPPP OOO TTTTT SSSSS PPPPP OOO TTTTT" 6 | echo " S P P O O T S P P O O T " 7 | echo " SSSSS PPPPP O O T SSSSS PPPPP O O T " 8 | echo " S P O O T S P O O T " 9 | echo " SSSSS P OOO T SSSSS P OOO T " 10 | echo "-----------------------------------------------------------" 11 | echo "SPOTSPOT - Spotify Downloader using spotDL" 12 | echo -e "\e[1;32mDesigned by MattBlackOnly\e[0m" 13 | echo "-----------------------------------------------------------" 14 | 15 | # Log versions 16 | if [ -z "$SPOTSPOT_VERSION" ]; then 17 | echo "SPOTSPOT_VERSION environment variable is not set." 18 | else 19 | echo "SpotSpot version: ${SPOTSPOT_VERSION}" 20 | fi 21 | 22 | if [ -f "requirements.txt" ]; then 23 | YT_DLP_VERSION=$(awk -F'==' '/yt_dlp\[default\]/{print $2}' requirements.txt) 24 | if [ -z "$YT_DLP_VERSION" ]; then 25 | echo "yt-dlp version not found in requirements.txt" 26 | else 27 | echo "yt-dlp version: $YT_DLP_VERSION" 28 | fi 29 | else 30 | echo "requirements.txt not found." 31 | fi 32 | 33 | spotdl_version=$(spotdl --version 2>&1) 34 | echo "SpotDL version: $spotdl_version" 35 | 36 | 37 | # Default values for PUID and PGID 38 | PUID=${PUID:-1000} 39 | PGID=${PGID:-1000} 40 | 41 | echo "Using PUID=${PUID} and PGID=${PGID}" 42 | 43 | # Modify the appuser and appgroup to match PUID and PGID 44 | if [ "$(id -u appuser)" != "$PUID" ] || [ "$(id -g appuser)" != "$PGID" ]; then 45 | echo "Updating UID and GID for appuser to match PUID:PGID..." 46 | deluser appuser 47 | addgroup -g "$PGID" appgroup 48 | adduser -D -u "$PUID" -G appgroup appuser 49 | fi 50 | 51 | # Ensure correct ownership 52 | echo "Setting up directories..." 53 | chown -R appuser:appgroup /config /data /home/appuser/.spotdl/.spotipy 54 | chmod -R 777 /config /home 55 | 56 | # Start the application as appuser 57 | echo "Starting SpotSpot..." 58 | exec su-exec appuser:appgroup gunicorn spotspot.spotspot:app -c start_app.py 59 | -------------------------------------------------------------------------------- /start_app.py: -------------------------------------------------------------------------------- 1 | bind = "0.0.0.0:6544" 2 | workers = 1 3 | threads = 4 4 | timeout = 180 5 | worker_class = "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" 6 | --------------------------------------------------------------------------------