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 url conversion (http to mopidy format) #1203

Merged
merged 2 commits into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions htdocs/inc.processCheckCardEditRegister.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,22 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
$post['audiofolderNew'] = $link = str_replace(array('http://','https://','/','=','-','.', 'www','?','&'), '', $post['streamURL']);
}

//wrong spotify url, convert to mopidy format
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)\//';
$patterns[2] = '/(\w+)\?(.*)/';
$replacements = array();
$replacements[0] = 'spotify:';
$replacements[1] = '$1:';
$replacements[2] = '$1';
$newSpotifyURL = preg_replace($patterns, $replacements, $post['streamURL']);
$messageError .= $lang['cardRegisterErrorConvertSpotifyURL']." (error 007)<br />".$post['streamURL']." ➔ ".$newSpotifyURL;
$post['streamURL'] = $newSpotifyURL;
}
s-martin marked this conversation as resolved.
Show resolved Hide resolved


/*
* any errors?
*/
Expand Down
1 change: 1 addition & 0 deletions htdocs/lang/lang-de-DE.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
$lang['cardRegisterErrorExistingAndNew'] = "<p>Das ist zu viel! Wähle entweder einen bestehenden Ordner aus oder erstelle einen neuen.</p>";
$lang['cardRegisterErrorExistingFolder'] = "<p>Ein Ordner mit dem gleichen Namen existiert bereits! Wähle einen anderen. </p>";
$lang['cardRegisterErrorSuggestFolder'] = "Ein Ordnername für den Stream muss erstellt werden. Unten im Formular steht ein Vorschlag.";
$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>";
Expand Down
1 change: 1 addition & 0 deletions htdocs/lang/lang-en-UK.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
$lang['cardRegisterErrorExistingAndNew'] = "<p>This is too much! Either choose an existing folder or create a new one.</p>";
$lang['cardRegisterErrorExistingFolder'] = "<p>A folder named with the same name already exists! Chose a different one.</p>";
$lang['cardRegisterErrorSuggestFolder'] = "A folder name for the stream needs to be created. Below in the form I made a suggestion.";
$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>";
Expand Down
1 change: 1 addition & 0 deletions htdocs/lang/lang-nl-NL.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
$lang['cardRegisterErrorExistingAndNew'] = "<p>Dit is te veel! Kies een bestaande map of maak een nieuwe map aan.</p>";
$lang['cardRegisterErrorExistingFolder'] = "<p>Er bestaat al een map met dezelfde naam! Kies een andere.</p>";
$lang['cardRegisterErrorSuggestFolder'] = "Er moet een mapnaam voor de stream worden gemaakt. Hieronder in het formulier heb ik een suggestie gedaan.";
$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>";
Expand Down