Random Albums and By Decade

24 views
Skip to first unread message

Bartolome Soriano

unread,
Nov 17, 2017, 11:29:47 AM11/17/17
to sonosp...@googlegroups.com
Hello Mark,

I am trying to get all of the views I find useful in the userindex2.ini.  

I was not able to figure out how to do the following:

1. Create an index that would bring me x random albums.

2. Creata an index of albums by decade.  I tried the following, which did not work:

tree=album/track
    title=By Decade

    index=album
entry=1920s
    sort_order=year
        entry_prefix=year{datetime.date.fromordinal(year).strftime("%Y")}
        range_field=year
        index_range=1920 to 1929

With that code, I get "Unable to browse music" when I click on "By Decade".

Please let me know how I could accomplish both of these.  Thanks!

Regards,

Bart

Mark Henkelis

unread,
Nov 19, 2017, 10:29:55 AM11/19/17
to sonosp...@googlegroups.com
1. There is currently no support for random selections. It's fairly trivial to add that to the select, but the controllers cache selections, so I'd have to find a bullet proof way to invalidate the content directory for each index that has random selections in it. If I invalidate each time for every index, you'd lose the caching and browsing would likely be slower. I thought about invalidating it overnight, but that won't solve repeated calls to the same random index within a day (I'm guessing if someone doesn't like the random, selection, they'd try again). I'll have a think about it.

2. You haven't specified a user-defined index to hold the decades. Try:

tree=decade/album/track
    title=By Decade
    index=decade
        entry=1920s
        index=album

        sort_order=year
            entry_prefix=year{datetime.date.fromordinal(year).strftime("%Y")}
            range_field=year
            index_range=1920 to 1929


--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.
To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.

Bartolome Soriano

unread,
Nov 19, 2017, 11:18:41 AM11/19/17
to sonosp...@googlegroups.com
Thanks Mark! 

1. I understand about random, I can live without this.  

2. I did not think about a user-defined index (I thought recent-entries was a built in index, for example). Will the index range values of 1920 to 1929 work for year? I know in the database you store the year as number of days since 1/1/1.  Will Sonospy convert it or do I have to specify the range in number of days since 1/1/1? It's no big deal to do so.

Regards,

Bart

To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-devel+unsubscribe@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-devel+unsubscribe@googlegroups.com.

Mark Henkelis

unread,
Nov 19, 2017, 11:32:14 AM11/19/17
to sonosp...@googlegroups.com
Range values 1920 to 1929 will work.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.

Bartolome Soriano

unread,
Nov 19, 2017, 12:02:41 PM11/19/17
to sonosp...@googlegroups.com
Thanks Mark! That worked great.  

How could I display both the year and the album artist as an entry prefix? I tried year{datetime.date.fromordinal(year).strftime("%Y")} - albumartist as an entry prefix, but this always shows 0 for the album artist.


Bartolome Soriano

unread,
Nov 19, 2017, 12:26:52 PM11/19/17
to sonosp...@googlegroups.com
One additional related question:

I wanted to further subdivide the decades by year, and I am doing the following:

index=decade
        entry=2000s
        
index=year
index_range=2000 to 2009
    index=album
            sort_order=year
                    entry_prefix=year{datetime.date.fromordinal(year).strftime("%Y")}

This works great, except that for the entries 2000s and 2010s, there are multiple entries for each year, so 2000 will be shown multiple times, 2001, etc.  Not all years are shown multiple times, and it only happens with those decades.  I have not been able to determine a pattern here, and there is usually just one album in each repeated entry (and that album is not in the first entry for the year), but sometimes there is more than one.

Mark Henkelis

unread,
Nov 19, 2017, 5:26:00 PM11/19/17
to sonosp...@googlegroups.com
You need to use a comma to separate prefixes in the list, so:

    year{datetime.date.fromordinal(year).strftime("%Y")}, albumartist
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.

Mark Henkelis

unread,
Nov 19, 2017, 5:28:08 PM11/19/17
to sonosp...@googlegroups.com
I wonder if it's related to what the year field actually contains in you database for those albums. Try outputting the full year field to see, rather than the formatted version.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.

Bartolome Soriano

unread,
Nov 19, 2017, 5:57:55 PM11/19/17
to sonosp...@googlegroups.com
Thanks Mark, I will try that to see what is going on.

Regards,

Bart

Bartolome Soriano

unread,
Nov 20, 2017, 11:24:04 AM11/20/17
to sonosp...@googlegroups.com
Mark,

You are correct.  The additional entries have a date in the year that is other than 1/1 of that year.  I will fix my tags and scan again.  Thanks.

Regards,

Bart

Bartolome Soriano

unread,
Nov 20, 2017, 6:11:36 PM11/20/17
to sonosp...@googlegroups.com
After fixing a subset of my tags, there is only one entry per year.  Now I will fix the rest of my tags.

I thought some more about the random albums, and the way I've seen other services handle that is that once you select Random Albums, the list does not change, until you select a different music service, select something there, and then go back to the original service and select Random Albums again.  Is this something you would be willing to add?

One additional thing.  How difficult would it be for you to show, similar to what Sonos does, at the track level the track name, and below it the track Artist (not in bold)? If possible, could you show at the album level the album name, and below it the Album Artist (not in bold)?

Finally, I apologize for all these questions, since some I realize are quite trivial.  I thought that once I finish setting up my indices the way I want, I can take all of the comments you have in defaultindex.ini, userindex.ini and userindex2.ini, as well as what I have done and the answers you have provided to my questions, and turn it into a "Sonospy Indexing Configuration Guide".  I would send that to you for your review and modifications, and then perhaps you could upload it to GitHub for everyone to use.  What do you think?

Once again, thanks.

Regards,

Bart

Bartolome Soriano

unread,
Nov 27, 2017, 8:24:36 AM11/27/17
to sonosp...@googlegroups.com
Hello Mark,

Any updates on this? Thanks for your help.

Regards,

Bart

MARK HENKELIS

unread,
Nov 27, 2017, 5:00:40 PM11/27/17
to sonosp...@googlegroups.com
Both are doable, I'll have a look.

And yes to the doc thanks.


From: "Bartolome Soriano" <bsor...@gmail.com>
To: sonosp...@googlegroups.com
Sent: Monday, 27 November, 2017 1:23:55 PM
Subject: Re: [sonospy-devel] Random Albums and By Decade
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.

Bartolome Soriano

unread,
Dec 19, 2017, 7:49:45 PM12/19/17
to sonosp...@googlegroups.com
Hello Mark,

Any progress on these? Please let me know.  Thanks.

Regards,

Bart

To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-devel+unsubscribe@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-devel+unsubscribe@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-devel+unsubscribe@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-devel+unsubscribe@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-devel+unsubscribe@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-devel+unsubscribe@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-devel+unsubscribe@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-devel+unsubscribe@googlegroups.com.

Bartolome Soriano

unread,
Feb 13, 2018, 11:51:23 AM2/13/18
to sonosp...@googlegroups.com
Hello Mark, any news on this? Thanks.

Regards,

Bart
Reply all
Reply to author
Forward
0 new messages