Added #4
authorRemixDev <deezloaderremix@gmail.com>
Mon, 6 May 2019 21:06:52 +0000 (23:06 +0200)
committerRemixDev <deezloaderremix@gmail.com>
Mon, 6 May 2019 21:06:52 +0000 (23:06 +0200)
app/app.js
app/public/css/style.css
app/public/index.html
app/public/js/appBase.js
app/public/js/frontend.js

index 423e5ce6a0b5d8e7399a4581d2030699b59d1269..b34e454291473867f128264785db5f4579a945d6 100644 (file)
@@ -436,6 +436,14 @@ io.sockets.on('connection', function (s) {
                });
        });
 
+       s.on("analyzetrack", async (id)=>{
+               s.emit("analyzetrack", await s.Deezer.legacyGetTrack(id))
+       })
+
+       s.on("analyzealbum", async (id)=>{
+               s.emit("analyzealbum", await s.Deezer.legacyGetAlbum(id))
+       })
+
        /*
         * Downloading section of the app
        */
index c93ad87b183b4688c971a2dd896473c6a34645b6..51740cdee914fee2d67ad6f636b883bbef097bb4 100644 (file)
@@ -188,6 +188,24 @@ nav {
   margin-bottom: 8px;
 }
 
+/* Link Analyzer*/
+.link_analyzer_info{
+       display: flex;
+       padding-top: 16px;
+}
+
+.link_analyzer_maininfo{
+       display: inline;
+       padding-left: 16px;
+       width: -webkit-fill-available;
+}
+
+.link_analyzer_sideinfo{
+    width: 250px;
+    min-width: 250px;
+    display: inline-block;
+}
+
 @media only screen and (max-width: 992px) {
        #nav-mobile .left{
                margin-right: 0px;
@@ -229,6 +247,14 @@ nav {
        #modal_login_btn_signup, #modal_login_btn_login{
                margin-top: 8px;
        }
+
+       #link_analyzer_song_maininfo{
+               padding: 0px 8px;
+       }
+
+       .link_analyzer_maininfo{
+               padding: 0px 8px;
+       }
 }
 
 nav .brand-logo{
index a5cac9cce393074cd6af9b3a334040d0d43716d4..0aa3bc0e5cb026fe2b2d9b155755ec6ab90a7567 100644 (file)
        </div>
 </div>
 
+<!--##########################################MODAL_ANALYZER_COUNTRY###########################################-->
+<div id="modal_link_analyzer_country" class="modal modal-fixed-footer">
+       <div class="modal-content">
+               <h4 class="col s12">Available Countries for {{ title }}</h4>
+               <table class="striped col s12">
+                       <thead>
+                               <tr>
+                                       <th style="width:24px;"></th>
+                                       <th>Country</th>
+                               </tr>
+                       </thead>
+                       <tbody>
+                               <tr v-for="cc in countries">
+                                       <td v-for="val in cc">{{ val }}</td>
+                               </tr>
+                       </tbody>
+               </table>
+       </div>
+       <div class="modal-footer">
+               <a href="#" class="modal-close waves-effect waves-light btn">Close</a>
+       </div>
+</div>
+
 <!--********************************************MAIN-CONTENT********************************************-->
 <nav>
   <div class="nav-wrapper">
   <li><a href="#!" tab-id="tab_search" class="sidenav_tab sidenav-close waves-effect"><i class="material-icons">search</i>Search</a></li>
   <li><a href="#!" tab-id="tab_charts" class="sidenav_tab sidenav-close waves-effect"><i class="material-icons">bubble_chart</i>Charts</a></li>
   <li><a href="#!" tab-id="tab_playlists" class="sidenav_tab sidenav-close waves-effect"><i class="material-icons">playlist_play</i>Playlists</a></li>
+       <li><a href="#!" tab-id="tab_link" class="sidenav_tab sidenav-close waves-effect"><i class="material-icons">link</i>Link Analyzer</a></li>
   <li><a href="#!" tab-id="tab_url" class="sidenav_tab sidenav-close waves-effect"><i class="material-icons">link</i>Download from URL</a></li>
   <li><a href="#!" tab-id="tab_downloads" class="sidenav_tab sidenav-close waves-effect"><i class="material-icons">get_app</i>Downloads</a></li>
   <li><div class="divider"></div></li>
     <li class="tab"><a class="active" href="#tab_search">Search</a></li>
     <li class="tab"><a href="#tab_charts">Charts</a></li>
     <li class="tab"><a href="#tab_playlists">Playlists</a></li>
+               <li class="tab"><a href="#tab_link">Link Analyzer</a></li>
     <li class="tab"><a href="#tab_url">Download from URL</a></li>
     <li class="tab"><a href="#tab_downloads">Downloads</a></li>
   </ul>
       </div>
     </div>
 
+               <div id="tab_link">
+                       <div class="inline-input-group">
+                               <input autocomplete="off" type="search" id="link_analyzer_url" class="input" placeholder="Song/Album URL">
+                               <button id="link_analyzer_go" class="btn btn-input btn-flat deezloader-primary white-text"><i class="material-icons">search</i></button>
+                       </div>
+
+                       <div id="link_analyzer_loading" class="center" hidden>
+                               <div class="preloader-wrapper big active">
+                                       <div class="spinner-layer spinner-blue-only">
+                                               <!-- Spinner Code -->
+                                               <div class="circle-clipper left"><div class="circle"></div></div><div class="gap-patch"><div class="circle"></div></div><div class="circle-clipper right"><div class="circle"></div></div>
+                                       </div>
+                               </div>
+                       </div>
+
+                       <div id="link_analyzer_start">
+                               <p class="secondary-text center">You can use this section to find out more information about the link you are trying to download<br/>
+                               This is usefull if you're trying to download some tracks that are not available in your country and want to know where they are available</p>
+                       </div>
+
+                       <div v-if="d.title" id="link_analyzer_song" class="link_analyzer_info">
+                               <div id="link_analyzer_song_sideinfo" class="hide-on-small-only link_analyzer_sideinfo">
+                                       <img v-bind:src=" d.album.cover_medium "/>
+                                       <a href="#modal_link_analyzer_country" class="modal-trigger waves-effect waves-light btn" style="width:100%;">See Available Countries</a>
+                               </div>
+                               <div id="link_analyzer_song_maininfo" class="link_analyzer_maininfo">
+                                       <h5 style="margin-bottom:8px; margin-top:0px;">{{ d.title }} {{ d.version }}<i v-if="d.explicit_lyrics" class="material-icons valignicon materialize-red-text tooltipped" data-tooltip="Explicit">explicit</i></h5>
+                                       <p style="margin-top:0px;">by <b>{{ d.artist.name }}</b></br>
+                                       in <b>{{ d.album.title }}</b></p>
+                                       <hr class="hide-on-small-only">
+                                       <a v-if="d.alternative" v-bind:href="'d.alternative.link'"><b>Alternative Link</b></a>
+                                       <table class="striped">
+                                               <tbody>
+                                                       <tr v-if="d.isrc"><td><b>ISRC</b></td><td>{{ d.isrc }}</td></tr>
+                                                       <tr v-if="d.duration"><td><b>Duration</b></td><td>{{ d.duration_string }}</td></tr>
+                                                       <tr v-if="d.disk_number"><td><b>Disc Number</b></td><td>{{ d.disk_number }}</td></tr>
+                                                       <tr v-if="d.track_position"><td><b>Track Number</b></td><td>{{ d.track_position }}</td></tr>
+                                                       <tr v-if="d.release_date"><td><b>Release Date</b></td><td>{{ d.release_date }}</td></tr>
+                                                       <tr v-if="d.bpm"><td><b>BPM</b></td><td>{{ d.bpm }}</td></tr>
+                                               </tbody>
+                                       </table>
+                                       <a href="#modal_link_analyzer_country" class="modal-trigger waves-effect waves-light btn hide-on-med-and-up" style="width:100%;">See Available Countries</a>
+                               </div>
+                       </div>
+
+                       <div v-if="d.title" id="link_analyzer_album" class="link_analyzer_info">
+                               <div id="link_analyzer_album_sideinfo" class="hide-on-small-only link_analyzer_sideinfo">
+                                       <img v-bind:src=" d.cover_medium "/>
+                                       <a v-on:click="showTrackListSelective(d.link)" class="waves-effect waves-light btn" style="width:100%;">Show Tracklist</a>
+                               </div>
+                               <div id="link_analyzer_album_maininfo" class="link_analyzer_maininfo">
+                                       <h5 style="margin-bottom:8px; margin-top:0px;">{{ d.title }} <i v-if="d.explicit_lyrics" class="material-icons valignicon materialize-red-text tooltipped" data-tooltip="Explicit">explicit</i></h5>
+                                       <p style="margin-top:0px;">by <b>{{ d.artist.name }}</b></br>
+                                       <b>{{ d.nb_tracks }}</b> {{ d.nb_tracks==1 ? 'track' : 'tracks' }}</p>
+                                       <hr class="hide-on-small-only">
+                                       <a v-if="d.alternative" v-bind:href="'d.alternative.link'"><b>Alternative Link</b></a>
+                                       <table class="striped">
+                                               <tbody>
+                                                       <tr v-if="d.upc"><td><b>UPC</b></td><td>{{ d.upc }}</td></tr>
+                                                       <tr v-if="d.duration"><td><b>Duration</b></td><td>{{ d.duration_string }}</td></tr>
+                                                       <tr v-if="d.release_date"><td><b>Release Date</b></td><td>{{ d.release_date }}</td></tr>
+                                                       <tr v-if="d.label"><td><b>Label</b></td><td>{{ d.label }}</td></tr>
+                                                       <tr v-if="d.record_type"><td><b>Record Type</b></td><td>{{ d.record_type.substring(0,1).toUpperCase()+ d.record_type.substring(1) }}</td></tr>
+                                                       <tr v-if="d.genres_string"><td><b>Genres</b></td><td>{{ d.genres_string }}</td></tr>
+                                               </tbody>
+                                       </table>
+                                       <a v-on:click="showTrackListSelective(d.link)" class="waves-effect waves-light btn hide-on-med-and-up" style="width:100%;">Show Tracklist</a>
+                               </div>
+                       </div>
+    </div>
+
     <div id="tab_url">
       <form id="tab_url_form_url" class="row">
         <div class="inline-input-group">
index 743fb72b22a636b51fbd7b7ad90855a8fa1a760b..19210b5292b490a1461350fc1a812772f5858c74 100644 (file)
@@ -69,7 +69,6 @@ const version = (typeof packageFile === 'undefined') ? $("#appVersionFallback").
 
        // Ready state of the page
        document.onreadystatechange = function () {
-               console.log(document.readyState)
                if (document.readyState == "interactive") {
                        initTitleBar()
                        $('#application_version_about').text(version)
index 31e68d8c1bc731b6cfbf475de4aed288ae8ada46..04d3a611f3fa15486c4961db144227da69dc89df 100644 (file)
@@ -14,6 +14,7 @@ var downloadQueue = []
 
 let preview_track = document.getElementById('preview-track')
 let preview_stopped = true
+const COUNTRIES = {"AF": "Afghanistan","AX": "\u00c5land Islands","AL": "Albania","DZ": "Algeria","AS": "American Samoa","AD": "Andorra","AO": "Angola","AI": "Anguilla","AQ": "Antarctica","AG": "Antigua and Barbuda","AR": "Argentina","AM": "Armenia","AW": "Aruba","AU": "Australia","AT": "Austria","AZ": "Azerbaijan","BS": "Bahamas","BH": "Bahrain","BD": "Bangladesh","BB": "Barbados","BY": "Belarus","BE": "Belgium","BZ": "Belize","BJ": "Benin","BM": "Bermuda","BT": "Bhutan","BO": "Bolivia, Plurinational State of","BQ": "Bonaire, Sint Eustatius and Saba","BA": "Bosnia and Herzegovina","BW": "Botswana","BV": "Bouvet Island","BR": "Brazil","IO": "British Indian Ocean Territory","BN": "Brunei Darussalam","BG": "Bulgaria","BF": "Burkina Faso","BI": "Burundi","KH": "Cambodia","CM": "Cameroon","CA": "Canada","CV": "Cape Verde","KY": "Cayman Islands","CF": "Central African Republic","TD": "Chad","CL": "Chile","CN": "China","CX": "Christmas Island","CC": "Cocos (Keeling) Islands","CO": "Colombia","KM": "Comoros","CG": "Congo","CD": "Congo, the Democratic Republic of the","CK": "Cook Islands","CR": "Costa Rica","CI": "C\u00f4te d'Ivoire","HR": "Croatia","CU": "Cuba","CW": "Cura\u00e7ao","CY": "Cyprus","CZ": "Czech Republic","DK": "Denmark","DJ": "Djibouti","DM": "Dominica","DO": "Dominican Republic","EC": "Ecuador","EG": "Egypt","SV": "El Salvador","GQ": "Equatorial Guinea","ER": "Eritrea","EE": "Estonia","ET": "Ethiopia","FK": "Falkland Islands (Malvinas)","FO": "Faroe Islands","FJ": "Fiji","FI": "Finland","FR": "France","GF": "French Guiana","PF": "French Polynesia","TF": "French Southern Territories","GA": "Gabon","GM": "Gambia","GE": "Georgia","DE": "Germany","GH": "Ghana","GI": "Gibraltar","GR": "Greece","GL": "Greenland","GD": "Grenada","GP": "Guadeloupe","GU": "Guam","GT": "Guatemala","GG": "Guernsey","GN": "Guinea","GW": "Guinea-Bissau","GY": "Guyana","HT": "Haiti","HM": "Heard Island and McDonald Islands","VA": "Holy See (Vatican City State)","HN": "Honduras","HK": "Hong Kong","HU": "Hungary","IS": "Iceland","IN": "India","ID": "Indonesia","IR": "Iran, Islamic Republic of","IQ": "Iraq","IE": "Ireland","IM": "Isle of Man","IL": "Israel","IT": "Italy","JM": "Jamaica","JP": "Japan","JE": "Jersey","JO": "Jordan","KZ": "Kazakhstan","KE": "Kenya","KI": "Kiribati","KP": "Korea, Democratic People's Republic of","KR": "Korea, Republic of","KW": "Kuwait","KG": "Kyrgyzstan","LA": "Lao People's Democratic Republic","LV": "Latvia","LB": "Lebanon","LS": "Lesotho","LR": "Liberia","LY": "Libya","LI": "Liechtenstein","LT": "Lithuania","LU": "Luxembourg","MO": "Macao","MK": "Macedonia, the Former Yugoslav Republic of","MG": "Madagascar","MW": "Malawi","MY": "Malaysia","MV": "Maldives","ML": "Mali","MT": "Malta","MH": "Marshall Islands","MQ": "Martinique","MR": "Mauritania","MU": "Mauritius","YT": "Mayotte","MX": "Mexico","FM": "Micronesia, Federated States of","MD": "Moldova, Republic of","MC": "Monaco","MN": "Mongolia","ME": "Montenegro","MS": "Montserrat","MA": "Morocco","MZ": "Mozambique","MM": "Myanmar","NA": "Namibia","NR": "Nauru","NP": "Nepal","NL": "Netherlands","NC": "New Caledonia","NZ": "New Zealand","NI": "Nicaragua","NE": "Niger","NG": "Nigeria","NU": "Niue","NF": "Norfolk Island","MP": "Northern Mariana Islands","NO": "Norway","OM": "Oman","PK": "Pakistan","PW": "Palau","PS": "Palestine, State of","PA": "Panama","PG": "Papua New Guinea","PY": "Paraguay","PE": "Peru","PH": "Philippines","PN": "Pitcairn","PL": "Poland","PT": "Portugal","PR": "Puerto Rico","QA": "Qatar","RE": "R\u00e9union","RO": "Romania","RU": "Russian Federation","RW": "Rwanda","BL": "Saint Barth\u00e9lemy","SH": "Saint Helena, Ascension and Tristan da Cunha","KN": "Saint Kitts and Nevis","LC": "Saint Lucia","MF": "Saint Martin (French part)","PM": "Saint Pierre and Miquelon","VC": "Saint Vincent and the Grenadines","WS": "Samoa","SM": "San Marino","ST": "Sao Tome and Principe","SA": "Saudi Arabia","SN": "Senegal","RS": "Serbia","SC": "Seychelles","SL": "Sierra Leone","SG": "Singapore","SX": "Sint Maarten (Dutch part)","SK": "Slovakia","SI": "Slovenia","SB": "Solomon Islands","SO": "Somalia","ZA": "South Africa","GS": "South Georgia and the South Sandwich Islands","SS": "South Sudan","ES": "Spain","LK": "Sri Lanka","SD": "Sudan","SR": "Suriname","SJ": "Svalbard and Jan Mayen","SZ": "Swaziland","SE": "Sweden","CH": "Switzerland","SY": "Syrian Arab Republic","TW": "Taiwan, Province of China","TJ": "Tajikistan","TZ": "Tanzania, United Republic of","TH": "Thailand","TL": "Timor-Leste","TG": "Togo","TK": "Tokelau","TO": "Tonga","TT": "Trinidad and Tobago","TN": "Tunisia","TR": "Turkey","TM": "Turkmenistan","TC": "Turks and Caicos Islands","TV": "Tuvalu","UG": "Uganda","UA": "Ukraine","AE": "United Arab Emirates","GB": "United Kingdom","US": "United States","UM": "United States Minor Outlying Islands","UY": "Uruguay","UZ": "Uzbekistan","VU": "Vanuatu","VE": "Venezuela, Bolivarian Republic of","VN": "Viet Nam","VG": "Virgin Islands, British","VI": "Virgin Islands, U.S.","WF": "Wallis and Futuna","EH": "Western Sahara","YE": "Yemen","ZM": "Zambia","ZW": "Zimbabwe"}
 
 // Popup message listener
 socket.on("message", function(desc){
@@ -267,6 +268,11 @@ $(document).ready(function () {
                        modalQuality.open = true
                }
        })
+
+       // Link Analyzer
+       $("#link_analyzer_go").click(function(){
+               parseLinkAnalyzer($("#link_analyzer_url").val())
+       })
 })
 
 // Load settings
@@ -1031,6 +1037,74 @@ socket.on("getMyPlaylistList", function (data) {
        $('.tooltipped').tooltip({delay: 100})
 })
 
+//###############################################TAB_LINK#############################################\\
+
+var linkAnalyzerSong = new Vue({
+       el: '#link_analyzer_song',
+       data: {
+               d:{}
+       }
+})
+
+var linkAnalyzerAlbum = new Vue({
+       el: '#link_analyzer_album',
+       data: {
+               d:{}
+       }
+})
+
+var linkAnalyzerCountryModal = new Vue({
+       el: '#modal_link_analyzer_country',
+       data: {
+               title: "",
+               countries: []
+       }
+})
+
+function parseLinkAnalyzer(link){
+       type = getTypeFromLink(link)
+       if (["track","album"].indexOf(type) == -1){
+               toast("Wrong Type")
+               return False
+       }
+       id = getIDFromLink(link)
+       $("#link_analyzer_start").hide()
+       $("#link_analyzer_album").hide()
+       $("#link_analyzer_song").hide()
+       $("#link_analyzer_loading").show()
+       socket.emit("analyze"+type, id)
+}
+
+socket.on("analyzetrack", (data)=>{
+       data.countries_string = ""
+       let countries = []
+       data.available_countries.forEach((cc)=>{
+               let temp = []
+               let chars = [...cc].map(c => c.charCodeAt() + 127397)
+               temp.push(String.fromCodePoint(...chars))
+               temp.push(COUNTRIES[cc])
+               countries.push(temp)
+       })
+       data.duration_string = convertDuration(data.duration)
+       linkAnalyzerCountryModal.title = `${data.title}${data.title_version ? ` ${data.title_version}`: ""}`
+       linkAnalyzerCountryModal.countries = countries
+       linkAnalyzerSong.d = data
+       $("#link_analyzer_loading").hide()
+       $("#link_analyzer_song").show()
+})
+
+socket.on("analyzealbum", (data)=>{
+       let genres = []
+       data.genres.data.forEach((genre)=>{
+               genres.push(genre.name)
+       })
+       data.genres_string = genres.join(", ")
+       data.duration_string = convertDuration(data.duration)
+       linkAnalyzerAlbum.d = data
+       $("#link_analyzer_loading").hide()
+       $("#link_analyzer_album").show()
+})
+
 //###############################################TAB_URL##############################################\\
 $('#tab_url_form_url').submit(function (ev) {