Skip to content
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

Spotify fixes #2315

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c73b6b8
feat: update spotify packages
AlvinSchiller Apr 2, 2024
35ca121
fix: removed unnecessary mopidy user conf
AlvinSchiller Apr 2, 2024
72aabd7
fix: dont start services right away (wait for reboot)
AlvinSchiller Apr 2, 2024
fca354f
fix: replace yotube-dl with yt-dlp. Run command in background
AlvinSchiller Apr 2, 2024
711d605
chore: update formatting and typo
AlvinSchiller Apr 2, 2024
2015098
fix: scan for mopidy on startup
AlvinSchiller Apr 5, 2024
22d44ae
fix: failure in check_chmod_chown should also fail overall tests
AlvinSchiller Apr 5, 2024
8c679e0
fix: change sudoers to seperate files
AlvinSchiller Apr 5, 2024
837fbbd
fix: python path for mopidy sudoers file
AlvinSchiller Apr 5, 2024
47c23d8
Merge remote-tracking branch 'MiczFlor/develop' into feature/mopidy-s…
AlvinSchiller Apr 9, 2024
3588ba0
test: add special characters for spotify password
AlvinSchiller Apr 10, 2024
f9451e1
fix: handle special charactes in spotify password correctly
AlvinSchiller Apr 10, 2024
b2448fc
fix: add handling for dollar char
AlvinSchiller Apr 11, 2024
7405ee1
fix: removed unnecessary options
AlvinSchiller Apr 11, 2024
035b8c1
fix: download plugin for correct architecture
AlvinSchiller Apr 11, 2024
3643da2
fix: also escape spotify client id and secret
AlvinSchiller Apr 11, 2024
9342926
fix: change targets for autohotspot services
AlvinSchiller Apr 11, 2024
1385700
fix: removed "spotify not working" note
AlvinSchiller Apr 11, 2024
12baf6d
fix: update Mopidy-Spotify to 5.0.0a2
AlvinSchiller Apr 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/bluetooth-sink-switch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ If no bluetooth device is connected, the output defaults back to speakers. After

### Limitations

This feature only works for the *Classic* Edition. Why? It relies on the mpd multiple output channels feature to switch between outputs. This is no available in mopidy, which is used in the Spotify Edition.
This feature only works for the *Classic* Edition. Why? It relies on the mpd multiple output channels feature to switch between outputs. This is not available in mopidy, which is used in the Spotify Edition.

## Installation

Expand Down
45 changes: 23 additions & 22 deletions htdocs/inc.processCheckCardEditRegister.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,27 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
$messageSuccess = "";

if($post['delete'] == "delete") {
$messageAction .= "<p>The card with the ID '".$post['cardID']." has been deleted.
If you made a mistake, this is your chance to press 'Submit' to restore the card settings.
$messageAction .= "<p>The card with the ID '".$post['cardID']." has been deleted.
If you made a mistake, this is your chance to press 'Submit' to restore the card settings.
Else: Go <a href='index.php' class='mainMenu'><i class='mdi mdi-home'></i> Home</a>.</p>";
// remove $fileshortcuts to cardID file in shortcuts
$exec = "rm ".$fileshortcuts;
if($debug == "true") {
print "<pre>deleting shortcut:\n";
print $exec;
print "</pre>";
}
}
exec($exec);
} elseif($post['submit'] == "submit") {
/*
* error check
*/

// posted too little?
if(
(!isset($post['streamURL']) || !isset($post['streamType']))
&& !isset($post['audiofolder'])
&& !isset($post['YTstreamURL'])
(!isset($post['streamURL']) || !isset($post['streamType']))
&& !isset($post['audiofolder'])
&& !isset($post['YTstreamURL'])
&& !isset($post['TriggerCommand'])
) {
$messageError .= $lang['cardRegisterErrorStreamOrAudio']." (error 002)";
Expand Down Expand Up @@ -161,9 +161,9 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
}

// streamFolderName not given
if(
(isset($post['streamURL']) || isset($post['YTstreamURL']))
&& !isset($post['audiofolder'])
if(
(isset($post['streamURL']) || isset($post['YTstreamURL']))
&& !isset($post['audiofolder'])
&& !isset($post['audiofolderNew'])
) {
$messageError .= $lang['cardRegisterErrorSuggestFolder']." (error 006)";
Expand All @@ -172,7 +172,7 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
}

//wrong spotify url, convert to mopidy format
if((isset($post['streamURL']) && $post['streamType'] == "spotify") && (strpos($post['streamURL'], "https://open.spotify.com/") !== false)){
if((isset($post['streamURL']) && $post['streamType'] == "spotify") && (strpos($post['streamURL'], "https://open.spotify.com/") !== false)){
$patterns = array();
$patterns[0] = '/https\:\/\/open.spotify.com/';
$patterns[1] = '/\/(playlist|album|track|artist)\//';
Expand Down Expand Up @@ -200,15 +200,15 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
* Stream URL to be created
*/
// 20200512 included code from removed the old include('inc.processAddNewStream.php');

// create new folder
$streamfolder = $Audio_Folders_Path."/".$post['audiofolderNew']."/";
$exec = "mkdir -p '".$streamfolder."'";
exec($exec);
// New folder is created so we link a RFID to it. Write $post['audiofolderNew'] to cardID file in shortcuts
$exec = "rm ".$fileshortcuts."; echo '".$post['audiofolderNew']."' > ".$fileshortcuts."; chmod 777 ".$fileshortcuts;
exec($exec);

// figure out $streamfile depending on $post['streamType']
switch($post['streamType']) {
case "spotify":
Expand All @@ -223,7 +223,7 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
default:
$streamfile = "url.txt";
}

// write $post['streamURL'] to $streamfile and make accessible to anyone
$exec = "echo '".$post['streamURL']."' > '".$streamfolder."/".$streamfile."'; sudo chmod -R 777 '".$streamfolder."'";
exec($exec);
Expand All @@ -235,15 +235,15 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
* RFID triggers system commands
*/
// 20200512 included code from removed the old include('inc.processAddTriggerCommand.php');

// Replace the potential existing RFID value with the posted one
//print $post['cardID']."->".$post['TriggerCommand'];
$fillRfidArrAvailWithUsed[$post['TriggerCommand']] = $post['cardID'];

/******************************************
* Create new conf file based on posted values
*/

// copy sample file to conf file
exec("cp ../settings/rfid_trigger_play.conf.sample ../settings/rfid_trigger_play.conf; chmod 777 ../settings/rfid_trigger_play.conf");
// replace posted values in new conf file
Expand All @@ -255,13 +255,13 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
}
// success message
$messageSuccess = $lang['cardRegisterTriggerSuccess']." ".$post['TriggerCommand'];
}
}
elseif(isset($post['YTstreamURL'])) {
/*******************************************************
* YouTube Download
*/
// 20200512 included code from removed the old include('inc.processAddYT.php');

if(isset($post['audiofolderNew'])) {
// create new folder
$exec = "mkdir --parents '".$Audio_Folders_Path."/".$post['audiofolderNew']."'; chmod 777 '".$Audio_Folders_Path."/".$post['audiofolderNew']."'";
Expand All @@ -278,11 +278,12 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
// link to existing audiofolder
$foldername = $Audio_Folders_Path."/".$post['audiofolder'];
}
$exec = "cd '".$foldername."'; youtube-dl -f bestaudio --extract-audio --audio-format mp3 ".$post['YTstreamURL']." > ".$conf['shared_abs']."/youtube-dl.log; chmod 777 ".$foldername."/* 2>&1 &";
exec($exec);
$exec = "cd '".$foldername."'; yt-dlp --compat-options youtube-dl -f bestaudio --extract-audio --audio-format mp3 '".$post['YTstreamURL']."' >> ".$conf['shared_abs']."/youtube-download.log 2>&1; chmod 777 ".$foldername."/*;";
s-martin marked this conversation as resolved.
Show resolved Hide resolved
# Run command in background!
exec("{ ".$exec." } > /dev/null &");
// success message
$messageSuccess = $lang['cardRegisterDownloadingYT'];
}
}
elseif(isset($post['audiofolder']) && trim($post['audiofolder']) != "false") {
/*******************************************************
* connect card with existing audio folder
Expand Down
2 changes: 1 addition & 1 deletion htdocs/lang/lang-de-DE.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
$lang['cardRegisterErrorConvertSpotifyURL'] = "Falsche Spotify URL, konvertiert in korrektes Format";
$lang['cardRegisterStream2Card'] = "Stream ist mit der Karten-ID verknüpft.";
$lang['cardRegisterFolder2Card'] = "Audio-Ordner ist nun mit der Karten-ID verknüpft.";
$lang['cardRegisterDownloadingYT'] = "<p>YouTube Audio wird heruntergeladen. Dies kann einige Minuten dauern. Du kannst die Logdatei \"youtube-dl.log\" im Ordner \"shared\" ansehen.</p>";
$lang['cardRegisterDownloadingYT'] = "<p>YouTube Audio wird heruntergeladen. Dies kann einige Minuten dauern. Du kannst die Logdatei \"youtube-download.log\" im Ordner \"shared\" ansehen.</p>";
$lang['cardRegisterSwipeUpdates'] = "Dies wird automatisch aktualisiert, wenn du eine RFID-Karte ausliest.";
$lang['cardRegisterManualLinks'] = "<p>Du kannst Karten auch manuell mit Ordnern verbinden. Das Handbuch erklärt, wie man sich <a href='https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/MANUAL#connect' target='-blank'>mit der Phoniebox verbindet</a> und <a href='https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/MANUAL#registering-cards-manually-through-samba-without-the-web-app' target='_blank'>Karten registriert</a>.</p>";
$lang['cardRegisterTriggerSuccess'] = "Die Karte ist jetzt verknüpft um die Funktion auszuführen:";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/lang/lang-en-UK.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
$lang['cardRegisterErrorConvertSpotifyURL'] = "Wrong spotify url, converted to the correct format";
$lang['cardRegisterStream2Card'] = "Stream is linked to Card ID.";
$lang['cardRegisterFolder2Card'] = "Audio folder is now linked to Card.";
$lang['cardRegisterDownloadingYT'] = "<p>YouTube audio is downloading. This may take a couple of minutes. You may check the logfile \"youtube-dl.log\" in the shared folder.</p>";
$lang['cardRegisterDownloadingYT'] = "<p>YouTube audio is downloading. This may take a couple of minutes. You may check the logfile \"youtube-download.log\" in the shared folder.</p>";
$lang['cardRegisterSwipeUpdates'] = "This will automatically update as you swipe a RFID card.";
$lang['cardRegisterManualLinks'] = "<p>You can also connect cards to folders manually. The manual explains how to <a href='https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/MANUAL#connect' target='–blank'>connect to the phoniebox</a> and <a href='https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/MANUAL#registering-cards-manually-through-samba-without-the-web-app' target='_blank'>register cards</a>.</p>";
$lang['cardRegisterTriggerSuccess'] = "The card is now linked to trigger the command:";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/lang/lang-fr-FR.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
$lang['cardRegisterErrorConvertSpotifyURL'] = "URL Spotify incorrecte, elle a été convertie au bon format";
$lang['cardRegisterStream2Card'] = "Le stream est lié à la carte.";
$lang['cardRegisterFolder2Card'] = "Le dossier audio est désormais lié à une carte.";
$lang['cardRegisterDownloadingYT'] = "<p>Piste YouTube en cours de téléchargement. Cela peut prendre plusieurs minutes. Log dans le fichier \"youtube-dl.log\".</p>";
$lang['cardRegisterDownloadingYT'] = "<p>Piste YouTube en cours de téléchargement. Cela peut prendre plusieurs minutes. Log dans le fichier \"youtube-download.log\".</p>";
$lang['cardRegisterSwipeUpdates'] = "Mise à jour automatique lors du passage d'une carte.";
$lang['cardRegisterManualLinks'] = "<p>Vous pouvez lier manuellement une carte à un dossier. Explication dans la documentation <a href='https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/MANUAL#connect' target='–blank'>connection à phoniebox</a> et <a href='https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/MANUAL#registering-cards-manually-through-samba-without-the-web-app' target='_blank'>enregistrer une carte</a>.</p>";
$lang['cardRegisterTriggerSuccess'] = "La carte est désormais lié à une commande :";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/lang/lang-nl-NL.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
$lang['cardRegisterErrorConvertSpotifyURL'] = "Verkeerde spotify url, geconverteerd naar het juiste formaat";
$lang['cardRegisterStream2Card'] = "Stream is gekoppeld aan kaart-ID.";
$lang['cardRegisterFolder2Card'] = "De audiomap is nu gekoppeld aan kaart-ID";
$lang['cardRegisterDownloadingYT'] = "<p>YouTube-audio wordt gedownload. Dit kan een paar minuten duren. U kunt het logbestand 'youtube-dl.log' in de gedeelde map controleren.</p>";
$lang['cardRegisterDownloadingYT'] = "<p>YouTube-audio wordt gedownload. Dit kan een paar minuten duren. U kunt het logbestand 'youtube-download.log' in de gedeelde map controleren.</p>";
$lang['cardRegisterSwipeUpdates'] = "Dit wordt automatisch bijgewerkt terwijl je een RFID-kaart veegt.";
$lang['cardRegisterManualLinks'] = "<p>U kunt kaarten ook handmatig met mappen verbinden. In de handleiding wordt uitgelegd hoe u <a href='https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/MANUAL#connect' target='–blank'>verbinding maakt met de phoniebox</a> en <a href='https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/MANUAL#registering-cards-manually-through-samba-without-the-web-app' target='_blank'>kaarten registreert</a>.</p>";

Expand Down
159 changes: 0 additions & 159 deletions misc/sampleconfigs/mopidy.sample

This file was deleted.

6 changes: 0 additions & 6 deletions packages-spotify.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
# Define packages for apt-get. These can be installed with
# 'sed 's/#.*//g' packages.txt | xargs sudo apt-get install'

libspotify-dev
libspotify12
python3-cffi
python3-ply
python3-pycparser
python3-spotify
mopidy
mopidy-mpd
mopidy-local
mopidy-spotify
7 changes: 5 additions & 2 deletions requirements-spotify.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Spotify related requirements
# You need to install these with `sudo pip install --upgrade --force-reinstall -r requirements-spotify.txt`
Mopidy-Iris==3.69.3
# You need to install these with `sudo pip install --upgrade --force-reinstall -r requirements-spotify.txt`
Mopidy-Local
Mopidy-MPD
Mopidy-Iris==3.69.3
Mopidy-Spotify==5.0.0a1
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# related libraries.
evdev
git+https://github.com/lthiery/SPI-Py.git#egg=spi-py
git+https://github.com/ytdl-org/youtube-dl@master#egg=youtube-dl
yt-dlp
pyserial
RPi.GPIO

Expand Down
Loading
Loading