Kodi Community Forum

Full Version: [RELEASE] Subsonic
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Okay so I realise about 6 months have passed since I said I'd try to some stuff with it. Had little time and motivation until today.

My plan for this plugin was mainly video usage. 6 months ago my problems with the add-on where the following :

a) Bit rate settings too low.
b) I proxy via mod_proxy under ssl and use basic authentication for my external subsonic. Yeah I know I'm paranoid.
c) When playing files in the plugin it would start multiple ffmpegs on the server and start multiple streams to xbmc.

============

I fixed a) one the following simple change :

Settings.xml

Code:
<setting id="bitrate" type="enum" label="30105" default="13" values="32k|40k|48k|56k|64k|80k|96k|112k|128k|160k|192k|224k|256k|320k" enable="eq(-1,true)" />

to

Code:
<setting id="bitrate" type="enum" label="30105" default="13" values="32k|40k|48k|56k|64k|80k|96k|112k|128k|160k|192k|224k|256k|320k|512K|720K|1024K|1500K|2048K" enable="eq(-1,true)" />

and

Subsonic.py

Code:
bitrates = [32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320]

Code:
bitrates = [32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 512, 720, 1024, 1500, 2048]

Nice and simple.

======

I fixed b) with the following function changes. https was working fine it was the basic auth that was causing the problem. I don't think this would cause an issue if basic auth was switched off but saying that I didn't test it.

Subsonic.py

Code:
def play(self, song_id):
        Addon.log('play: ' + song_id)
        if Addon.get_setting('transcode') == 'true':
            bitrate = self.bitrates[int(Addon.get_setting('bitrate'))]
            
            non_user_url = self.build_rest_url('stream.view',
                {'id': song_id,
                'maxBitRate': bitrate});
            
            user_url = non_user_url.replace("://", "://" +self.user + ":" + self.password + "@",1)
            
            Addon.resolve_url(user_url)
        else:
            Addon.resolve_url(self.build_rest_url('download.view',
                                                  {'id': song_id}))

....

  def __get_json(self, method, queries={}):
        json_response = None
        url = self.build_rest_url(method, queries)
        Addon.log('getting ' + url)
        try:
            password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
            password_mgr.add_password(None, self.server, self.user, self.password)
            handler = urllib2.HTTPBasicAuthHandler(password_mgr)
            opener = urllib2.build_opener(handler)
            urllib2.install_opener(opener)
            
            response = urllib2.urlopen(url)
            try:
                json_response = json.loads(response.read())
            except ValueError:
                Addon.show_error([Addon.get_string(30002)])
                return False
        except urllib2.URLError, e:
            Addon.show_error([Addon.get_string(30001), str(e.reason)])
            return False

        payload = json_response.get('subsonic-response', None)
        if payload.get('status', 'failed') == 'ok':              
            return payload
        else:
            Addon.show_error([payload['error']['message'],
                       'json version: ' + payload['version']])  
            return False


======

c) was somewhat tricker. Have no clue about xbmc or python addons I just assumed it was some problem with the plugin. However after digging these seems to be a problem with the way Xbmc Interacts with Subsonic.

It looks as though instead of just getting the stream from subsonic with a GET request it will do one or more HEAD request first. I can only guess this is so that it can select the right player.

Subsonic doesn't differentiate between the HEAD and GET and sends the full body instead of just the http header. So hence the multiple streams.

Here is a change I made to subsonic to get around this issue :

StreamController.java

Code:
....
                String transcodedSuffix = transcodingService.getSuffix(player, file, preferredTargetFormat);
                response.setContentType(StringUtil.getMimeType(transcodedSuffix));

                if (file.isVideo()) {
                    videoTranscodingSettings = createVideoTranscodingSettings(file, request);
                }
....

to

Code:
String transcodedSuffix = transcodingService.getSuffix(player, file, preferredTargetFormat);
                response.setContentType(StringUtil.getMimeType(transcodedSuffix));

                if (request.getMethod().equals("HEAD"))
                {
                    return null;
                }
                
                if (file.isVideo()) {
                    videoTranscodingSettings = createVideoTranscodingSettings(file, request);
                }

I just compiled the project and replaced this class file with a tomcat restart.

I suspect this may also have caused symptoms like having to manually select the DVD Player which just worked after this change.


========

I tried this with xbmc running on an original xbox and on xbmc running on an atv2. Both worked really well after these changes.


Disclaimer : I'm not a python/java developer so these mods may not be the best way to handle these problems and may be a bit "hacky".

Dybuk
dybuk,

Are these settings modified on my pc with xbmc and the plugin or on my server with subsonic installed?
nutt318 Wrote:dybuk,

Are these settings modified on my pc with xbmc and the plugin or on my server with subsonic installed?

for a) and b) they are a modification of the plugin zip file. Or they can just be modified in the revenant xbmc directory.

for c) you need to modify subsonic and recompile it. Something like :

- Install subversion and maven.
- svn co https://subsonic.svn.sourceforge.net/svn...elease-4.6
- Modify the streamController.java as described above.
- mvn compile
- find streamController.class in your newly compiled version and copy that over the top of streamContoller.class on your server.
- Restart subsonic.

I sent an email to the subsonic developer and he said he'd look to include a fix for this in 4.7

Dybuk.
First of all. Thanks for the great addon. It's brilliant.

I'm not sure that I am posting this in the right forum, but I think so.

I have the latest version of the addon running with the latest Eden beta on an ATV 2. The music is organized on the server like this:

library name/artist/album title/song title

I can display the library names as a list (the way I want it).
I can display the artists as a list (the way I want it).
I cannot display the album titles as thumbnails unless I go into each folder and specifically set it. Is there a way that I can set this for all albums? Having to set this manually for 1,000s of albums wouldn't be any fun at all.

Thanks in advance.
A
I've had Subsonic for awhile and ran across this when I was thinking of making a plugin myself. Nice to see it is already out there and works with Eden. However, I don't see the plugin on the subsonic pages. Where can I download this?

-hogfan
Repository for the plugin is in the first post, as always Wink
Installed on Eden RC 2 ATV2.

Can browse, but can't play.

Pasting the link into my browser downloads the file.

Pastebin
http://pastebin.com/vdrEAVNP

Your assistance appreciated
I have the latest version of this addon installed and working on an ATV2 running eden RC2. The server is running subsonic 4.6.

I have noticed in the subsonic server log that tracks are started multiple times (maybe 2-3 dozen times) which is causing the play count to go way out of whack. For example, if I play an album (that has never been played) once using the addon, the play count goes from none to maybe 300-400.

Has anyone else seen this? Is there a fix?

Thanks,
A
bahman2000 If i think correctly, try it without ssl ... think I fell over the same problem if I remember correctly.
(2012-03-12, 21:42)mason Wrote: [ -> ]bahman2000 If i think correctly, try it without ssl ... think I fell over the same problem if I remember correctly.

mason thanks for the response

changed to no https, still no sound

take a look at the pastebin
http://pastebin.com/z98rDR48

throwing the link into the browser switches over to https though...
In your last log the port is missing in the configuration, is this correct since it seems not able to open the url. Do you have a special setup regarding subsonic or just default?

10:15:11 T:106819584 WARNING: FillBuffer: curl failed with code 33
(2012-03-14, 10:42)mason Wrote: [ -> ]In your last log the port is missing in the configuration, is this correct since it seems not able to open the url. Do you have a special setup regarding subsonic or just default?

10:15:11 T:106819584 WARNING: FillBuffer: curl failed with code 33

i shouldn't need a port # for straight up http with this config:
http://ptpimg.me/lz971a.png

or am i wrong?
Seems legit, just thought it might be an error since the default port is 4040 if I remember correctly. Tried disabling SSL completly?
I have been using this addon for a couple of days and all is well though I can't get any cover art to show, does this addon support cover art?
yep, just turn of the library view while browsing in the addon.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16