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

Offline mode support #20

Closed
YehudaEi opened this issue Mar 2, 2022 · 5 comments
Closed

Offline mode support #20

YehudaEi opened this issue Mar 2, 2022 · 5 comments

Comments

@YehudaEi
Copy link

YehudaEi commented Mar 2, 2022

No, this is not a duplication of #19 .

I wanted to ask if in case the songs already exist on the computer offline, is it possible to cancel the requests to Spotify's server (because then it blocks me after some time).
The information should be stored locally on the computer, and there is no need to make a new request to the server.

Thanks.

@YehudaEi
Copy link
Author

YehudaEi commented Mar 2, 2022

I now looked at the code and saw that only some of the information was saved.
I understand that this question is irrelevant (I myself edited the js so that he would not make a request, and I give up this information).

@YehudaEi YehudaEi closed this as completed Mar 2, 2022
@WhEntrecote
Copy link

If you solved it, can you share?

@YehudaEi
Copy link
Author

YehudaEi commented Mar 7, 2022

I edited the "getTrackMetaProps" function (attached below code).
In addition, I wrote a script in AutoIt3 that reopen Spotify when she crashes (for me it would happen when I was there at high speed).

async getTrackMetaProps(track) {
        let meta = track.metadata;
        let testArt = [meta.artist_name];
        for(let i = 1; true; i++){
            if(meta["artist_name:" + i] != undefined){
                testArt.push(meta["artist_name:" + i]);
            }
            else{
                break;
            }
        }
        document.getElementById("console").innerText = testArt.toString();
        //let extraMeta = await _resources__WEBPACK_IMPORTED_MODULE_2__["default"].getTrackMetadataWG(track.uri);
        let { year, month, day } = [0, 0, 0];//extraMeta.album.date;
        let date = [year, month, day];
        //Truncate date to available precision
        if (!day)
            date.pop();
        if (!month)
            date.pop();
        return {
            title: meta.title,
            album_artist: meta.artist_name,
            album: meta.album_title,
            artist: testArt.join("/"), //extraMeta.artist.map(v => v.name).join("/"),
            track: meta.album_track_number,
            totaltracks: meta.album_track_count,
            disc: meta.album_disc_number,
            totaldiscs: meta.album_disc_count,
            date: date.map(x => _utils__WEBPACK_IMPORTED_MODULE_0__["default"].padInt(x, 2)).join('-'),
            publisher: "YE Software ~ Soggfy", //extraMeta.album.label,
            language: undefined, //extraMeta.language_of_performance?.[0],
            isrc: undefined, //extraMeta.external_id.find(v => v.type === "isrc")?.id,
            comment: _resources__WEBPACK_IMPORTED_MODULE_2__["default"].getOpenTrackURL(track.uri),
            explicit: meta.is_explicit ? "1" : undefined
        };
    }

@owovin
Copy link

owovin commented Apr 26, 2022

i find that the snippet you have written above does not properly work, in the version provided in the readme (version 1.1.84.716), the written code ends up erroring out:
[DBG] Requesting metadata for playback 395498fa6bcefdf3e58b8be7b51971e2... [INF] Discarding playback 395498fa6bcefdf3e58b8be7b51971e2: Cannot set properties of null (setting 'innerText')
commenting out the innertext works fine, but then it still depends on making fetch to the spotify servers to obtain metadata, of which is undesirable since i want to run this without any connection to the spotify servers
if you have any clue on how to fix this, that would be nice, thank you!

@Rafiuth
Copy link
Owner

Rafiuth commented Apr 27, 2022

I think commenting out document.getElementById("console").innerText = testArt.toString(); will work just fine,
let extraMeta = await _resources__WEBPACK_IMPORTED_MODULE_2__["default"].getTrackMetadataWG(track.uri); is the line making the extra request, which is already commented out in the snippet.

(that request will almost always be cached, since Spotify always makes it whenever a song starts playing for some reason).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants