Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Senior Member
    Join Date
    Apr 2005
    Posts
    8,410

    Favorites adding objects not urls

    Hi,

    I seem to be seeing corruption of the favorites url array. On looking at this when playing remote streams it looks to me that
    Favorites plugin is trying to add an object rather than a url to the favorite list.

    Should favourites be able to deal with either or should everything be an object by the time that favorites runs
    Slim::Player::Playlist::song($client) ? If so what's the best way to convert to the url - just use $obj->url ?

    Adrian


  2. #2
    NOT a Slim Devices Employee kdf's Avatar
    Join Date
    Apr 2005
    Posts
    9,493

    Favorites adding objects not urls

    Quoting Triode <triode1 (AT) btinternet (DOT) com>:

    > Should favourites be able to deal with either or should everything be
    > an object by the time that favorites runs
    > Slim::Player::Playlist::song($client) ? If so what's the best way to
    > convert to the url - just use $obj->url ?
    >

    I'm not sure how you would be able to store the favourites list as objects in
    the prefs files. The plugin probably has to do all its internal
    handling in the
    form of URL's. $obj-url should work after getting an abject from
    Player::Playlist::song(), but it would be a good idea to make sure the $obj
    return ed is a proper object before using the accessor (just in case). At
    change 4426, song() was changed to standardise on returning an object, so it
    should be safe. I'm just a bit skittish still when it comes to
    accessors. They
    are not forgiving. I'm not sure why I missed this call to songs(). The find
    all should have listed it.

    -k

  3. #3
    Senior Member
    Join Date
    Apr 2005
    Posts
    8,410

    Favorites adding objects not urls

    Actually turns out that the problem case I was looking at is the call to Slim::Utils::Favorites::clientAdd from TrackInfo.

    The simplest fix appears to be for Slim::Utils::Favorites::clientAdd to extract the url if it is sent an object.

    Is:
    if (ref($url)) { $url = $url->url; }

    sufficient to do this? [if so I'm not going to look at this now until tomorrow so fix if appropriate]

    Adrian



  4. #4
    NOT a Slim Devices Employee kdf's Avatar
    Join Date
    Apr 2005
    Posts
    9,493

    Favorites adding objects not urls

    On 11-Oct-05, at 4:28 PM, Triode wrote:

    > Actually turns out that the problem case I was looking at is the call
    > to Slim::Utils::Favorites::clientAdd from TrackInfo.
    >
    > The simplest fix appears to be for Slim::Utils::Favorites::clientAdd
    > to extract the url if it is sent an object.
    >
    > Is:
    > if (ref($url)) { $url = $url->url; }
    >
    > sufficient to do this? [if so I'm not going to look at this now until
    > tomorrow so fix if appropriate]
    >

    seems fair enough, but I can't see the problem that requires this.
    Entering trackinfo and accessing favourites, I see only urls from the
    d_favorites and d_prefs logs.

    for example:

    2005-10-11 21:09:03.0260 Favorites: found favorite number 5:
    2005-10-11 21:09:03.0266 Setting prefs favorite_urls 4 equal to
    file:///media/Unsorted/INCUBUS/A%20Crow%20Left%20of%20the%20Murder/
    INCUBUS%20%20(01)%20Megalomaniac.mp3
    2005-10-11 21:09:03.0269 Setting prefs favorite_titles 4 equal to
    Megalomaniac
    2005-10-11 21:09:06.0276 Writing out prefs in /etc/slimserver.conf
    2005-10-11 21:10:51.8502 Favorites: found favorite number 3:
    file:///media/Flac/Pearl%20Jam/15-6
    -00,%20Spodek,%20Katowice%20Poland%20(Disk%202)Pear l%20Jam%20-
    %20(01)%20Insignificance.flac
    2005-10-11 21:11:31.8397 Setting prefs favorite_titles 3 equal to
    Megalomaniac
    2005-10-11 21:11:31.8407 Setting prefs favorite_urls 3 equal to
    file:///media/Unsorted/INCUBUSA%20Crow%20Left%20of%20the%20Murder/
    INCUBUS%20-%20(01)%20Megalomaniac.mp3

    -kdf


  5. #5
    Perl Commando Dan Sully's Avatar
    Join Date
    Apr 2005
    Location
    Daly City, CA
    Posts
    2,865

    Favorites adding objects not urls

    * kdf shaped the electrons to say...

    >>Actually turns out that the problem case I was looking at is the call
    >>to Slim::Utils::Favorites::clientAdd from TrackInfo.
    >>
    >>The simplest fix appears to be for Slim::Utils::Favorites::clientAdd
    >>to extract the url if it is sent an object.
    >>
    >>Is:
    >>if (ref($url)) { $url = $url->url; }
    >>
    >>sufficient to do this? [if so I'm not going to look at this now until
    >>tomorrow so fix if appropriate]


    Keep in mind, that a $track object stringifies to $track->url;

    -D
    --
    Minds are like parachutes... they work best when open.

  6. #6
    Senior Member
    Join Date
    Apr 2005
    Posts
    8,410

    Re: Favorites adding objects not urls

    The problem I see is that the pref file gets corrupted - I believe this is due to the preference writing not dealing with objects

    Hence it appears to work as long as the server is running as the in memory array contains an object - which is fine.
    But if you look at what gets written to the prefs file for an object it is not simply the url.
    So when you stop and restart the server you get corruption of the urls favorites trys to play.

    So I conclude we need to force it to a string when we add it to a preference??

    Adrian
    ----- Original Message -----
    From: "Dan Sully" <dan (AT) slimdevices (DOT) com>
    To: "Slim Devices Developers" <developers (AT) lists (DOT) slimdevices.com>
    Sent: Wednesday, October 12, 2005 6:56 AM
    Subject: [Developers] Re: Favorites adding objects not urls


    >* kdf shaped the electrons to say...
    >
    >>>Actually turns out that the problem case I was looking at is the call
    >>>to Slim::Utils::Favorites::clientAdd from TrackInfo.
    >>>
    >>>The simplest fix appears to be for Slim::Utils::Favorites::clientAdd
    >>>to extract the url if it is sent an object.
    >>>
    >>>Is:
    >>>if (ref($url)) { $url = $url->url; }
    >>>
    >>>sufficient to do this? [if so I'm not going to look at this now until
    >>>tomorrow so fix if appropriate]

    >
    > Keep in mind, that a $track object stringifies to $track->url;
    >
    > -D
    > --
    > Minds are like parachutes... they work best when open.
    >

  7. #7
    Perl Commando Dan Sully's Avatar
    Join Date
    Apr 2005
    Location
    Daly City, CA
    Posts
    2,865

    Re: Favorites adding objects not urls

    * Triode shaped the electrons to say...

    >The problem I see is that the pref file gets corrupted - I believe this is
    >due to the preference writing not dealing with objects
    >Hence it appears to work as long as the server is running as the in memory
    >array contains an object - which is fine. But if you look at what gets
    >written to the prefs file for an object it is not simply the url.
    >So when you stop and restart the server you get corruption of the urls
    >favorites trys to play.
    >
    >So I conclude we need to force it to a string when we add it to a preference??


    Yes - that'd be a good way of dealing with it.

    Something like:

    if (ref($prefValue) && UNIVERSAL::isa($prefValue, 'Slim:ataStores:BI:ataModel')) {

    $prefValue = $prefValue->stringify_self;
    }

    -D
    --
    It is dark. You are likely to be eaten by a grue.

  8. #8
    NOT a Slim Devices Employee kdf's Avatar
    Join Date
    Apr 2005
    Posts
    9,493

    Re: Favorites adding objects not urls

    Quoting Triode <triode1 (AT) btinternet (DOT) com>:

    > The problem I see is that the pref file gets corrupted - I believe
    > this is due to the preference writing not dealing with objects Hence
    > it appears to work as long as the server is running as the in memory
    > array contains an object - which is fine. But if you look at what
    > gets written to the prefs file for an object it is not simply the url.
    > So when you stop and restart the server you get corruption of the
    > urls favorites trys to play.
    >
    > So I conclude we need to force it to a string when we add it to a
    > preference??


    I have no problem with forcing a url. But, I also haven't seen a problem with
    the prefs (other than early mixups with name->url swapping, which I have seen
    reported but haven't reproduced since early testing)

    just now, through browse music down to trackinfo, I added a track to
    the faves,
    and I get:
    favorite_titles:
    - How I'm Comin'
    - 'Alternative: RADIO DAVIDBYRNE.COM'
    - ''
    - ''
    - ''
    favorite_urls:
    - file:///D:/mp3/test/01%20How%20I%27m%20Comin%27.mp3
    - http://www.kcrw.com/pls/kcrwmusic.pls
    - ''
    - ''
    - ''

    what is it that you are seeing? I wasn't sure where the objects were being
    converted to urls for the pref, but as I wasn't getting any wrong output, I
    didn't question it much further

    -k


  9. #9
    Senior Member
    Join Date
    Apr 2005
    Posts
    8,410

    Re: Favorites adding objects not urls

    I get:

    favorite_titles:
    - Radio 1 Listen Live
    - Radio 2 Listen Live
    - ''
    - ''
    - ''
    - ''
    - ''
    - ''
    - ''
    favorite_urls:
    - &1 rtsp://rmlivev8.bbc.net.uk/farm/*/ev7/live24/radio1/live/r1_dsat_g2.ra
    - *1
    - ''
    - ''
    - ''
    - ''
    - ''
    - ''
    - ''

    When I add the first track it looks OK, but then adding the second adds &1 in front of the first url and *1 for the second.

    Dumping the contents of the preference at this point shows it contains objects rather than strings [assuming I don't stop the
    server]

    Adrian

    ----- Original Message -----
    From: "kdf" <slim-mail (AT) deane-freeman (DOT) com>
    To: <developers (AT) lists (DOT) slimdevices.com>
    Sent: Wednesday, October 12, 2005 6:44 PM
    Subject: Re: [Developers] Re: Favorites adding objects not urls


    > Quoting Triode <triode1 (AT) btinternet (DOT) com>:
    >
    >> The problem I see is that the pref file gets corrupted - I believe this is due to the preference writing not dealing with objects
    >> Hence it appears to work as long as the server is running as the in memory array contains an object - which is fine. But if you
    >> look at what gets written to the prefs file for an object it is not simply the url.
    >> So when you stop and restart the server you get corruption of the urls favorites trys to play.
    >>
    >> So I conclude we need to force it to a string when we add it to a preference??

    >
    > I have no problem with forcing a url. But, I also haven't seen a problem with
    > the prefs (other than early mixups with name->url swapping, which I have seen
    > reported but haven't reproduced since early testing)
    >
    > just now, through browse music down to trackinfo, I added a track to the faves,
    > and I get:
    > favorite_titles:
    > - How I'm Comin'
    > - 'Alternative: RADIO DAVIDBYRNE.COM'
    > - ''
    > - ''
    > - ''
    > favorite_urls:
    > - file:///D:/mp3/test/01%20How%20I%27m%20Comin%27.mp3
    > - http://www.kcrw.com/pls/kcrwmusic.pls
    > - ''
    > - ''
    > - ''
    >
    > what is it that you are seeing? I wasn't sure where the objects were being
    > converted to urls for the pref, but as I wasn't getting any wrong output, I
    > didn't question it much further
    >
    > -k
    >
    >

  10. #10
    Senior Member
    Join Date
    Apr 2005
    Posts
    8,410

    Re: Favorites adding objects not urls

    I should add that these two urls are definately different, but only in the trailing last few characters...

    Is YAML trying to do some form of compression?

    Dan - what should happen when Slim::Utils::Unicode::utf8off is run on an object?
    ----- Original Message -----
    From: "Triode" <triode1 (AT) btinternet (DOT) com>
    To: "Slim Devices Developers" <developers (AT) lists (DOT) slimdevices.com>
    Sent: Wednesday, October 12, 2005 7:12 PM
    Subject: Re: [Developers] Re: Favorites adding objects not urls


    >I get:
    >
    > favorite_titles:
    > - Radio 1 Listen Live
    > - Radio 2 Listen Live
    > - ''
    > - ''
    > - ''
    > - ''
    > - ''
    > - ''
    > - ''
    > favorite_urls:
    > - &1 rtsp://rmlivev8.bbc.net.uk/farm/*/ev7/live24/radio1/live/r1_dsat_g2.ra
    > - *1
    > - ''
    > - ''
    > - ''
    > - ''
    > - ''
    > - ''
    > - ''



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •