Added full artist list in ARTISTS tag option
authorRemixDev <deezloaderremix@gmail.com>
Thu, 9 Jan 2020 14:47:08 +0000 (15:47 +0100)
committerRemixDev <deezloaderremix@gmail.com>
Thu, 9 Jan 2020 14:47:08 +0000 (15:47 +0100)
Adds #105

app/app.js
app/default.json
app/public/js/frontend.js
app/public/locales/en.json
app/views/index.ejs

index 11c906b1e160ee4faedc426ce85115b9d7cebe59..197586d1db499a8cc28a212156331b5456f79174 100644 (file)
@@ -1907,6 +1907,50 @@ io.sockets.on('connection', function (s) {
                                        track.mixerString = uniqueArray(track.contributor.mixer)
                                        if (!(track.selectedFormat == 9 && settings.multitagSeparator == "null")) track.mixerString = track.mixerString.join(separator)
                                }
+
+                               let mainArtists = []
+                               let featuredArtists = []
+                               if (track.contributor.main_artist){
+               mainArtists = mainArtists.concat(track.contributor.main_artist)
+             }else if (track.contributor.mainartist){
+               mainArtists = mainArtists.concat(track.contributor.mainartist)
+             }
+                               if (track.contributor.featuredartist) {
+                                       featuredArtists = featuredArtists.concat(track.contributor.featuredartist)
+                               }
+        if (track.contributor.featuring) {
+                                       featuredArtists = featuredArtists.concat(track.contributor.featuring)
+                               }
+                               mainArtists = uniqueArray(mainArtists, true)
+                               featuredArtists = uniqueArray(featuredArtists, true)
+                               track.fullArtist = ""
+                               if (mainArtists.length > 0){
+                                       let tot = mainArtists.length
+                                       mainArtists.forEach((art, i) =>{
+                                               track.fullArtist += art
+                                               if (tot !== i+1){
+                                                       track.fullArtist += " & "
+                                               }
+                                       })
+                               }
+                               track.featuredArtists = ""
+                               if (featuredArtists.length > 0){
+                                       track.featuredArtists += "feat. "
+                                       let tot = featuredArtists.length
+                                       featuredArtists.forEach((art,i) =>{
+                                               track.featuredArtists += art
+                                               if (tot !== i+1){
+                                                       if (tot-1 === i+1){
+                                                               track.featuredArtists += " & "
+                                                       }else{
+                                                               track.featuredArtists += ", "
+                                                       }
+                                               }
+                                       })
+                               }
+                               if (track.featuredArtists !== ""){
+                                       track.fullArtist += " "+track.featuredArtists
+                               }
                        }
 
                        if(track.artists || track.artistsString){
@@ -1964,7 +2008,9 @@ io.sockets.on('connection', function (s) {
                // Generating file name
                let filename = ""
                if (settings.saveFullArtists){
-                       if (settings.multitagSeparator == "null"){
+                       if (track.fullArtist){
+                               filename = antiDot(fixName(`${track.fullArtist} - ${track.title}`));
+                       }else if (settings.multitagSeparator == "null"){
                                if (Array.isArray(track.artistsString)){
                                        filename = antiDot(fixName(`${track.artistsString.join(", ")} - ${track.title}`));
                                }else{
@@ -2574,7 +2620,9 @@ function settingsRegex(track, filename, playlist) {
                filename = filename.replace(/%album%/g, fixName(track.album.title));
                if (configFile.userDefined.saveFullArtists){
                        let artistString
-                       if (Array.isArray(track.artistsString)){
+                       if (track.fullArtist){
+                               artistString = track.fullArtist
+                       }else if (Array.isArray(track.artistsString)){
                                artistString = track.artistsString.join(", ")
                        }else if (configFile.userDefined.multitagSeparator == "null"){
                                artistString = track.artistsString.split(String.fromCharCode(0)).join(", ")
@@ -2891,6 +2939,9 @@ function getMetadata(buf, track, settings){
        if(track.replayGain && settings.tags.replayGain)
                flac.setTag('REPLAYGAIN_TRACK_GAIN=' + track.replayGain);
 
+       if (settings.tags.fullArtist && track.fullArtist)
+               flac.setTag('ARTISTS=' + track.fullArtist);
+
        if(track.album.picturePath && settings.tags.cover){
                flac.importPicture(track.album.picturePath);
        }
@@ -2964,6 +3015,11 @@ function getID3(track, settings){
                });
        if (settings.savePlaylistAsCompilation)
                writer.setFrame('TCMP', 1)
+       if (settings.tags.fullArtist && track.fullArtist)
+               writer.setFrame('TXXX', {
+                       description: 'ARTISTS',
+                       value: track.fullArtist
+               });
        writer.addTag();
        return Buffer.from(writer.arrayBuffer);
 }
index 1ba23acb3137e7da0fda7b99b3420cd12caca63e..79f6b2176b43135559aab14574c07c67efd7bf4f 100644 (file)
@@ -71,7 +71,8 @@
                        "author": false,
                        "writer": false,
                        "engineer": false,
-                       "producer": false
+                       "producer": false,
+                       "fullArtists": false
                }
        }
 }
index 35320fcf60942543d71e7164399284e6f050a159..4617f52f058632eafff6ca4b2c483ec595e17466 100644 (file)
@@ -570,7 +570,8 @@ $('#modal_settings_btn_saveSettings').click(function () {
                        author: $('#modal_tags_author').is(':checked'),
                        writer: $('#modal_tags_writer').is(':checked'),
                        engineer: $('#modal_tags_engineer').is(':checked'),
-                       producer: $('#modal_tags_producer').is(':checked')
+                       producer: $('#modal_tags_producer').is(':checked'),
+                       fullArtist: $('#modal_tags_fullArtist').is(':checked')
                }
        }
        let spotifyUser = $('#modal_settings_input_spotifyUser').val()
@@ -707,6 +708,7 @@ function fillSettingsModal(settings, spotifySettings = {clientId: "", clientSecr
        $('#modal_tags_writer').prop('checked', settings.tags.writer)
        $('#modal_tags_engineer').prop('checked', settings.tags.engineer)
        $('#modal_tags_producer').prop('checked', settings.tags.producer)
+       $('#modal_tags_fullArtist').prop('checked', settings.tags.fullArtist)
 
        M.updateTextFields()
 }
index 522144ab09acd12f00033d884bda622142ad9eee..d21708eebc445f7ee401433525031e48a830c2c8 100644 (file)
        "Start Case": "Start Case",
        "Sentence case": "Sentence case",
        "Case for Title": "Case for Title",
-       "Case for Artist": "Case for Artist"
-}
+       "Case for Artist": "Case for Artist",
+       "Full artist list": "Full artist list"
+}
\ No newline at end of file
index 549837bafa52bb3bd68e558e514843f01f8ad262..f7fcbc4132cd22a15c21fafda24b2828c63228e6 100644 (file)
                                        <span><%= __('Producer')%></span>
                                </label>
                        </p>
+                       <p class="col s12 m4">
+                               <label>
+                                       <input type="checkbox" id="modal_tags_fullArtist" class="filled-in"/>
+                                       <span><%= __('Full artist list')%></span>
+                               </label>
+                       </p>
                </div>
        </div>
        <div class="modal-footer">