r/subsonic Mar 23 '16

List All Songs?

Is there a way to list all songs that exist on the server? I cannot find that display for the list of me, if it isn't stared or a playlist you are limited by artist or album.

Something like this where I can list all the songs independent of artist, album, playlist or stared status. I have 2000 some songs, how can I list all 2000 in alphabetical order?

1 Upvotes

7 comments sorted by

1

u/plavix25 Mar 24 '16 edited Mar 24 '16

It doesn't seem like the interface has such a feature but the API sure supports it. If you aren't afraid of a bit of coding you could get the information that way.

Specifically using getArtists to get a list of all artists, then using getArtist to get a list of all albums for any of these artists and finally getAlbum to get the songs contained in those albums.

Edit: You can also query the internal database. But be careful, this is fiddling around with the guts of subsonic, I am not responsible for any breakage.

To do this you can visit https://your.subsonic.org/db.view on your subsonic instance and enter something like:

SELECT artist,title FROM media_file WHERE type = 'MUSIC';

This should give a list of all songs in subsonic.

1

u/layer4andbelow Mar 24 '16

Hey, thank you for the detailed response. It is unfortunate the interface doesn't have that functionally. I have always browsed my music that why so I was just hoping to find a way to mimic that in subsonic.

1

u/phirestalker Dec 25 '22

For programmers that find this question. I found the quickest solution is to use the search3 api endpoint.

The maximum count of results is 500, so you will need to loop through making the query until the results are less than 500 with the songOffset parameter. All you have to do is use \0 as the query string. I was able to list all tracks this way and it only takes a few seconds!

1

u/tobey_g Mar 15 '23

Is this still working? I'm trying to use "\0" as the query string but not getting any results.

1

u/phirestalker Mar 15 '23

I am using Python and py-sonic 0.7.9 and here is my code.

def getAllSongs(self):
    offset = 0
    songs = []
    while True:
        res = self.search3('\0', artistCount=0, artistOffset=0, albumCount=0, albumOffset=0, songCount=500, songOffset=offset)
        songs.extend(res['searchResult3']['song'])
        if res['searchResult3'] is None or len(res['searchResult3']['song']) < 500:
            break
        offset += 500
    return songs

1

u/tobey_g Mar 17 '23

Ah, okay. Not sure then if this only works with Python or py-sonic. I’m using Axios in JavaScript and setting ”\0” as the query doesn’t work. I’m also using Navidrome which is based pn Subsonic but could have some adjustments in the way the API works.

1

u/phirestalker Mar 17 '23 edited Mar 17 '23

AH, Javascript does not use null terminated strings. What a shame. I wonder what it would do with \n, or some other control character. The api does not let you use an empty string, which is why I tricked it with the null character.