-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add songs from external drives to ~/pikaraoke-songs #289
add songs from external drives to ~/pikaraoke-songs #289
Conversation
Not sure how to properly make a merge request here but the main changes I wanted to add were the 2 scripts and a dependency (or sudo apt install) for plocate in setup.sh combine.sh binds mount points to /media/unified using names like sda1 sda2 and such. This solves issue #287 in a roundabout way. create_database.sh uses plocate to create a local database with the absolute paths to all songs. so now pikaraoke can see your songs that were already in ~/pikaraoke-songs/ PLUS every song in every external drive and every subfolder. Still thinkin of a way to use this to make a cache so you don't have to load every song on startup. combine.sh runs create_database.sh so just run that to run both. |
combine.sh
Outdated
#!/bin/bash | ||
shopt -s globstar | ||
|
||
path="/home/$(logname)/pikaraoke-songs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assumes the user is downloading to pikaraoke-songs, which may not be the case if they change the download dir.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I should have it take in whatever the user sets for the -d option, and ~/pikaraoke-songs otherwise.
In that case, I'd insert a call to the script in app.py. will revise.
combine.sh
Outdated
while IFS= read -r song || [ -n "$song" ]; do | ||
if [[ ! -e "$path/$(basename "$song")" ]]; then | ||
BASE=$(basename "$song") | ||
ln -sf "$song" "/home/pi/pikaraoke-songs/$BASE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assumes the user is "pi"
I appreciate the pull request, but I may need to hold off on this because it has a lot of hard-coded paths and it's not cross-platform. |
I could add a check for the OS like you have elsewhere in your code. I suppose the right answer is to rewrite it in python so it works on windows too, although I'm not sure how I'd go about it. Maybe run this script if linux/macOS, and then have a separate python implementation for windows? |
Yes to make it fully cross platform, this should be done in python. The scripts are really only for installing dependencies and setting up python environments. I'll post some suggestions in #286 |
f1296fa
to
f25e326
Compare
Added 2 scripts that create symbolic links from all songs from external drives to ~/pikaraoke-songs, including songs in subfolders.