Skip to content

Commit 8b9badd

Browse files
authored
Merge pull request #66 from casualsnek/development
Merge Development
2 parents 58bb188 + ac87cbe commit 8b9badd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2020
-1164
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ lib64/
2020
parts/
2121
sdist/
2222
var/
23+
release/
2324
wheels/
2425
pip-wheel-metadata/
2526
share/python-wheels/
2627
*.egg-info/
2728
.installed.cfg
2829
*.egg
2930
MANIFEST
31+
PKGBUILD/*.xz
32+
PKGBUILD/*.zip
33+
PKGBUILD/pkg/
34+
PKGBUILD/src/
35+
PKGBUILD/.SRCINFO
3036

3137
# PyInstaller
3238
# Usually these files are written by a python script from a template
@@ -105,6 +111,7 @@ celerybeat.pid
105111
# Environments
106112
.env
107113
.venv
114+
.idea
108115
env/
109116
venv*/
110117
ENV/

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/onthespot.iml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PKGBUILD/PKGBUILD

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
pkgname=onthespot-git
2+
pkgver=0.5
3+
_branch="main"
4+
pkgrel=1
5+
pkgdesc="Qt based music downloader written in python"
6+
arch=('any')
7+
url="https://github.com/casualsnek/onthespot"
8+
license=('GPLv2')
9+
depends=('ffmpeg' 'python-requests' 'python-pyqt5' 'python-pillow' 'python-show-in-file-manager' 'python-certifi' 'python-pyxdg' 'python-librespot' 'python-music-tag')
10+
conflicts=('onthespot')
11+
provides=('onthespot')
12+
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
13+
optdepends=()
14+
source=("https://github.com/casualsnek/onthespot/archive/refs/heads/$_branch.zip")
15+
sha256sums=(SKIP)
16+
17+
build() {
18+
cd "onthespot-$_branch"
19+
python -m build --wheel --no-isolation
20+
}
21+
22+
pkgver() {
23+
grep "self.version = *" "$PWD/onthespot-$_branch/src/onthespot/otsconfig.py" | sed 's/self.version = //g;s/ //g'
24+
}
25+
26+
package() {
27+
cd "onthespot-$_branch"
28+
python -m installer --destdir="$pkgdir" dist/*.whl
29+
install -dm 755 "$pkgdir/usr/share/applications"
30+
install -dm 755 "$pkgdir/usr/share/icons/hicolor/"{256x256,scalable}"/apps/"
31+
install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
32+
install -Dm 644 "src/onthespot/resources/org.eu.casualsnek.onthespot.desktop" "$pkgdir/usr/share/applications/"
33+
install -Dm 644 "src/onthespot/resources/icon.svg" "$pkgdir/usr/share/icons/hicolor/scalable/apps/casual_onthespot.svg"
34+
install -Dm 644 "src/onthespot/resources/icon.png" "$pkgdir/usr/share/icons/hicolor/256x256/apps/casual_onthespot.png"
35+
}

README.md

Lines changed: 57 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1+
![Logo](src/onthespot/resources/icon.png)
2+
13
# Onthespot
4+
25
qt based music downloader written in python.
6+
37
![Screenshot](https://i.imgur.com/C4V94gy.png)
48

59
### Discord for discussions: [Discord Invite](https://discord.gg/hz4mAwSujH)
610
If you have an idea for an improvement or feature, create a issue or join the discord server to discuss!
711

812
# 1. Installing/launching application:
9-
## 1.1. From source
13+
## 1.1. Launch without installing - from source
1014
Make sure [python3](https://www.python.org/downloads) and [Git](https://git-scm.com/downloads) are installed on your system, if you are on windows you also need to install Microsoft C++ build tools from [HERE](https://visualstudio.microsoft.com/visual-cpp-build-tools/) and restart your computer before starting build process.
1115
- Download or Clone the repo ```git clone https://github.com/casualsnek/onthespot```
1216
- Navigate to the onthespot directory ```cd onthespot```
1317
- Install the dependencies with ```pip install -r requirements.txt```
14-
- Launch the application with ```python3 __init__.py```
18+
- Navigate to source directory ```cd src```
19+
- Launch the application with ```python3 -m onthespot```
1520

1621
*Windows users should also follow these extra steps before running:* ```python3 onthespot.py```
1722
```
1823
pip install winsdk
1924
```
2025

21-
## 1.2. Using prebuilt binaries
26+
## 1.2. Using portable prebuilt binaries
2227
### On Linux
2328
#### Arch Linux
2429
`onthespot` is available for arch linux and arch linux based distributions in arch user repository (aur) as [onthespot-git](https://aur.archlinux.org/packages/onthespot-git).
@@ -37,24 +42,25 @@ Download Latest 'onthespot_linux' from the release section and execute with
3742
./onethespot_linux
3843
```
3944
### On Windows
40-
Download Latest 'onthespot_win_ffm.exe' or 'onthespot_win.exe' from the Release section and execute by double clicking the downloaded file.
45+
Download Latest 'onthespot_win_ffm.exe' or 'onthespot_win.exe' from the Release section and execute by double-clicking the downloaded file.
4146

4247
The binaries with filename ending with '_ffm' have ffmpeg bundled and should not require manual installation.
4348

4449
If you are using binaries that does not bundle ffmpeg and downloads gets stuck at 99% with ```Converting``` on progress text, you are missing ffmpeg ! Please install it by following the instructions below
4550

4651
#### Installing ffmpeg in windows
4752
- Open Windows Explorer and Navigate to ```C:\``` Drive and make a folder name ```ffmpeg``` there
48-
- Download ffmpef zip from [https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z](https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z) then copy the ``bin`` folder from zip to ```C:\ffmpeg```
53+
- Download ffmpeg zip from [https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z](https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z) then copy the ``bin`` folder from zip to ```C:\ffmpeg```
4954
- Open CMD as administrator and run the command: ```setx /m PATH "C:\ffmpeg\bin;%PATH%"```
5055

5156
Now the application should work as expected.
5257

5358

54-
# 2. Building manually
55-
Building on any OS requires Git, Python3 and Pip installed. Make sure you have them installed !
59+
# 2. Building/packaging manually
60+
Building or packaging on any OS requires Git, Python3 and Pip installed. Make sure you have them installed !
5661

57-
## 2.1. On Linux/nix
62+
## 2.1. Building portable binaries
63+
### 2.1.1 On Linux/nix
5864
Open terminal emulator and run the following command to clone the repository and build.
5965
```bash
6066
git clone https://github.com/casualsnek/onthespot
@@ -67,8 +73,7 @@ bash ./build_linux.sh
6773
```
6874
After the command completes, you should have a 'dist' directory in repository root containing built 'onthespot_linux' binary.
6975

70-
## 2.2. On Windows
71-
Download Microsoft C++ build tools from [Here](https://visualstudio.microsoft.com/visual-cpp-build-tools/). Setup/Install it and reboot your computer. ( Required for building simpleaudio python module)
76+
### 2.1.2. On Windows
7277

7378
Open cmd and run the following command to clone the repository and build.
7479
```cmd
@@ -84,20 +89,36 @@ build_winC2.bat
8489
```
8590
After the command completes, you should have a 'dist' directory in repository root containing built 'onthespot_win.exe' binary.
8691

92+
## 2.2. Building wheel for installing with pip
93+
You can also build onthespot as wheel and install it as python module via pip in your system. It provides better integration with system, like using your system's Qt style and themes as well as you can use provided icon and .desktop file for better integration under linux systems.
94+
95+
Make sure you have set up tools installed !
96+
97+
Open terminal emulator and run the following command to clone the repository and build.
98+
```bash
99+
git clone https://github.com/casualsnek/onthespot
100+
cd onthespot
101+
python -m build
102+
```
103+
This will create a dist directory containing .whl file that can now be installed with pip, the application can be launched with the command ```onthespot_gui``` or ```python3 -m onthespot``` after installing !
104+
105+
**NOTE :** If you are packaging onthespot for distribution, copy ```src/onthespot/resources/icon.svg``` to either ```/usr/share/icons/hicolor/scalable/apps/casual_onthespot.svg``` or ```$HOME/.local/share/icons/hicolor/scalable/apps/casual_onthespot.svg```, and ``` src/onthespot/resources/org.eu.casualsnek.onthespot.desktop``` to either ```/usr/share/applications/org.eu.casualsnek.onthespot.desktop``` or ```$HOME/.local/share/applications/org.eu.casualsnek.onthespot.desktop```. This allows application to be better integrated to desktop environments !
87106

88-
If you have ideas for improvement/features create a issue or join discord server for discussion !
107+
<br>
108+
If you have ideas for improvement/features create an issue or join discord server for discussion !
89109

90110
# 3. Basic Usage
91111
## Getting started
92112
On your first launch of application you will get a warning that no spotify accounts are added, click ok and add your account(s) at the bottom of the application. After adding your accounts, close and restart the application. Having multiple accounts will let you download multiple songs at a time.
93113

94114
## Searching/Downloading via query
95-
Click on 'Search' tab then enter your query and cick search to search for songs/artists/albums/playlists and click download.
115+
Click on 'Search' tab then enter your query and click search to search for songs/artists/albums/playlists and click download.
96116
You can download any media like 'Albums', 'Tracks', etc., that appear on the results table all at once by using the download buttons below the results table.
97117
*Note that Media Type other than 'Tracks' can take a little longer to parse and download. The application may appear to be frozen in this state !*
98118

99119
## Downloading by URL
100-
Enter the url in the url field then click download.
120+
Enter the url in the search field then click download.
121+
You can also enter path of text file containing URL, and it will queue all url(s) in it !
101122
*Note that Media Type other than 'Tracks' can take a little longer to parse and download. Application may appear to be frozen in this state !*
102123

103124
## Download status
@@ -123,12 +144,20 @@ Default track names are ```AlbumFormatter/TrackName```
123144
- **Track name formatter**:
124145
This option allows you to set the naming scheme of downloaded tracks.
125146
Variables can be used by enclosing them between `{}`. A few variables are available to use in the naming scheme:
126-
- artist : name of artist of track
127-
- album : name of album the track is in *
128-
- name : name of track
129-
- rel_year : release year of track
130-
- disc_number : disk number in which track lies *
131-
- track_number : serial Number of track in album *
147+
- artist : Name of artist of track
148+
- album : Name of album the track is in *
149+
- name : Name of track
150+
- rel_year : Release year of track
151+
- disc_number : Disk number in which track lies *
152+
- track_number : Serial Number of track in album *
153+
- playlist_name : Name of playlist if the track is being downloaded as part of playlist *
154+
- playlist_owner : Name of playlist if the track is being downloaded as part of playlist *
155+
- playlist_desc : Description of playlist if the track is being downloaded as part of playlist *
156+
- genre : Genre of song *
157+
- label : Name of record label
158+
- explicit : 'Explicit' if the song is marked explicit else it will be blank
159+
- trackcount : Total number of tracks on the album this track is in
160+
- disccount : Total number of discs on the album this track is in
132161
- spotid : Spotify ID
133162
- Example: ```Song: {name} of album: {album} Released in {rel_year}```.
134163
The value of variables with their description ending in * maybe empty in some cases. This can also be a path.
@@ -139,8 +168,13 @@ Variables can be used by enclosing them between `{}`. A few variables are availa
139168
- artist : name of the main artist of the album
140169
- rel_year: the release year of the album *
141170
- album: name of the album
171+
- playlist_name : Name of playlist if the track is being downloaded as part of playlist *
172+
- playlist_owner : Name of playlist if the track is being downloaded as part of playlist *
173+
- playlist_desc : Description of playlist if the track is being downloaded as part of playlist *
174+
- genre : Genre of song *
175+
- label : Name of record label
142176
- Example: ```{artist}/{rel_year}/{album}```.
143-
The value of variables with their description ending in * maybe empty in some cases. This can be a path too.
177+
The value of variables with their description ending in * maybe empty in some cases. This can be a path too.
144178

145179
- **Download chunk size**:
146180
Size of chunks (bytes) used for downloading.
@@ -153,25 +187,20 @@ Time to wait before attempting another download after failed attempt.
153187

154188
- **Skip bytes at the end (download end skip bytes)**:
155189
Sometimes the last few bytes of a track can't be downloaded which causes 'PD Error' to show up which causes downloads to fail constantly, this sets the number of bytes to skip downloading if this happens.
156-
The value might change but the current working vaue is '167' bytes. If you get 'decode errors' or incomplete song downloads try setting it to 0.
190+
The value might change but the current working value is '167' bytes. If you get 'decode errors' or incomplete song downloads try setting it to 0.
157191

158192
- **Force Artist/Album dir for track/playlist items**:
159193
If this is disabled the tracks downloaded will be placed in the root of download directory instead of artist/album directories.
160-
Enabling this might cause slower download parsing but makes orgainsing music easier.
194+
Enabling this might cause slower download parsing but makes organising music easier.
161195

162196
- **Media Format**:
163197
Format of media you want your final music download to be in.
164198
Do not include '.' in it. This setting will be ignored while using the raw media download option.
165199

166200
# 5. Issues
167201
Decode error: If you are receiving this error, your account might have got restricted. Wait some time or try a different account. The application may crash frequently as there is no proper exception handling yet. You can help by opening a new issue with the error message displayed in your console window after the application misbehaves.
168-
169-
# 6. TODOS
170-
- ~~Synced lyrics downloads~~
171-
- Improve UI/UX ( Suggestions needed by users )
172-
- Refactor code
173202

174-
# 7. Contributing/Supporting
203+
# 6. Contributing/Supporting
175204
You can write code to include additional feature or bug fixes or make a issue regarding bugs and features or just spread the work about the application :)
176205
If you want to support financially, you can visit [Here](https://github.com/casualsnek/casualsnek) and support through open collective or BTC
177206
If you like the project, show your support by giving it a star :) !

__init__.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

build_linux.sh

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,57 @@
11
#!/bin/bash
2+
3+
clean_build_dirs () {
4+
[ -d ./__pycache__ ] && rm -rf __pycache__
5+
[ -d ./build ] && rm -rf ./build
6+
[ -d ./venv ] && rm -rf ./venv
7+
[ -f ./onthespot_linux.spec ] && rm ./onthespot_linux.spec
8+
[ -f ./onthespot_linux_ffm.spec ] && rm ./onthespot_linux_ffm.spec
9+
}
10+
11+
212
echo "========= OnTheSpot Linux Build Script ==========="
313
echo " => Cleaning up !"
4-
rm -rf __pycache__
5-
if [ -f "./dist/onthespot_linux" ]; then
6-
rm ./dist/onthespot_linux
7-
fi
8-
rm -rf ./build
9-
rm -rf ./venv
14+
[ -f ./dist/onthespot_linux ] && rm ./dist/onthespot_linux
15+
[ -f ./dist/onthespot_linux_ffm ] && rm ./dist/onthespot_linux_ffm
16+
clean_build_dirs
17+
1018
echo " => Creating virtual env."
1119
python3 -m venv venv
20+
1221
echo " => Switching to virtual env."
1322
source ./venv/bin/activate
23+
1424
echo " => Installing 'pyinstaller' via pip..."
1525
pip install pyinstaller
16-
echo " => Installing dependencies pip..."
26+
27+
echo " => Installing dependencies to venv with pip..."
1728
pip install -r requirements.txt
29+
1830
if [ -f "ffbin_nix/ffmpeg" ]; then
1931
echo " => Found 'ffbin_win' directory and ffmpeg binary.. Using ffmpeg binary append mode "
2032
pyinstaller --onefile \
21-
--add-data="gui/qtui/*.ui:qui/qtui" \
22-
--add-binary="ffbin_nix/*:bin/ffmpeg" \
23-
--paths="." \
24-
--name="onthespot_linux" \
25-
__init__.py
33+
--add-data="src/onthespot/gui/qtui/*.ui:onthespot/gui/qtui" \
34+
--add-data="src/onthespot/resources/*.png:onthespot/resources" \
35+
--add-binary="ffbin_nix/*:onthespot/bin/ffmpeg" \
36+
--paths="src/onthespot" \
37+
--name="onthespot_linux_ffm" \
38+
--icon="src/onthespot/resources/icon.png" \
39+
src/portable.py
2640
else
2741
echo " => Building to use ffmpeg binary from system... "
2842
pyinstaller --onefile \
29-
--add-data="gui/qtui/*.ui:gui/qtui" \
30-
--paths="." \
43+
--add-data="src/onthespot/gui/qtui/*.ui:onthespot/gui/qtui" \
44+
--add-data="src/onthespot/resources/*.png:onthespot/resources" \
45+
--paths="src/onthespot" \
3146
--name="onthespot_linux" \
32-
__init__.py
47+
--icon="src/onthespot/resources/icon.png" \
48+
src/portable.py
3349
fi
34-
echo " => Setting permissions.. "
35-
chmod +x ./dist/onthespot_linux
36-
echo " => Cleaning.. "
37-
rm onthespot_linux.spec
38-
rm -rf ./build
39-
rm -rf __pycache__
50+
echo " => Setting executable permissions.. "
51+
[ -f ./dist/onthespot_linux ] && chmod +x ./dist/onthespot_linux &>./build_nix.log
52+
[ -f ./dist/onthespot_linux_ffm ] && chmod +x ./dist/onthespot_linux_ffm &>./build_nix.log
53+
54+
echo " => Cleaning .. "
55+
clean_build_dirs
56+
4057
echo " => Done "

build_winC1.bat

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
@echo off
22
echo ========= OnTheSpot Windows Build Script ===========
3-
echo =^> Cleaning up !"
4-
rmdir build /s /q
5-
rmdir __pycache__ /s /q
6-
rmdir venvwin /s /q
3+
echo =^> Cleaning up !
4+
if exist build\ (
5+
rmdir build /s /q
6+
)
7+
if exist __pycache__\ (
8+
rmdir __pycache__ /s /q
9+
)
10+
if exist venvwin\ (
11+
rmdir venvwin /s /q
12+
)
13+
714
if exist dist\onthespot_win.exe (
815
del /F /Q /A dist\onthespot_win.exe
916
)
17+
if exist dist\onthespot_win_ffm.exe (
18+
del /F /Q /A dist\onthespot_win_ffm.exe
19+
)
1020
echo =^> Creating virtual env.
1121
python.exe -m venv venvwin
1222
echo =^> Switching to virtual env.

0 commit comments

Comments
 (0)