Small suggestions for code changes

fjans

New member
Oct 28, 2016
5
0
0
Here are some small changes I propose:

1) Fix the sort order of the recordings (the recordings are not shown chronologically right now):
get_recordings: Add "datetimestart" to "recordings.append" and use that value when sorting. See this pastebin: http://pastebin.com/He5KLb9j

2) limit the number of JSON requests when starting a live stream or recording: only request the JSON data for the selected live stream or recording. Why do you request the JSON data for live streams and recordings that are not requested by the user?
You can have just one JSON request per link by checking for the name (play) or scheduleid (play_dvr). See: http://pastebin.com/FD19gHR4

The pastebins just contain some snippets. I hope they're clear. If not, let me know!
 

mhancoc7

m7
Staff member
Aug 2, 2015
1,742
12
38
m7kodi.dev
Here are some small changes I propose:

1) Fix the sort order of the recordings (the recordings are not shown chronologically right now):
get_recordings: Add "datetimestart" to "recordings.append" and use that value when sorting. See this pastebin: http://pastebin.com/He5KLb9j

2) limit the number of JSON requests when starting a live stream or recording: only request the JSON data for the selected live stream or recording. Why do you request the JSON data for live streams and recordings that are not requested by the user?
You can have just one JSON request per link by checking for the name (play) or scheduleid (play_dvr). See: http://pastebin.com/FD19gHR4

The pastebins just contain some snippets. I hope they're clear. If not, let me know!
Thanks for posting these. A quick look I think these are some very good changes. I will be testing these tonight and if I don't find any issues (which I don't think I will) I will push and update!

Thanks for sending these!
 

mhancoc7

m7
Staff member
Aug 2, 2015
1,742
12
38
m7kodi.dev
Ok your second suggestion is EXCELLENT! Can't believe i missed that. :)

Now for the first suggestion. I think I put the Recordings in the order of the most recently set to record for a reason. I am not sure if it was requested or if I preferred it that way to begin with. Also, it looks like there is a much easier fix for this (unless I am missing something). If you just remove the "reverse=True" from line 196 in main.py it seems to put it in the order that you are shooting for.

This one is a bit subjective so I am going to leave it as is for now until I understand better the reason for setting the order so the oldest recording is at the top.

Thanks again for your suggestions. I will be pushing the 2nd one very soon!
 

fjans

New member
Oct 28, 2016
5
0
0
Thanks for applying the second suggestion!

About the sort order or the recordings: right now the order is not correct in my opinion. This is what I see right now (of a total of 214 recordings):

Top 5 results:
- recording from 10/19/16
- recording from 10/20/16
- recording from 10/20/16
- recording from 11/8/16
- recording from 10/20/16

Bottom 5 results:
- recording from 10/16/16
- recording from 10/19/16
- recording from 10/20/16
- recording from 10/18/16
- recording from 10/17/16

As you can see, all dates are totally mixed up. It's practically impossible to find a recording this way.
 
Last edited:

mhancoc7

m7
Staff member
Aug 2, 2015
1,742
12
38
m7kodi.dev
Thanks for applying the second suggestion!

About the sort order or the recordings: right now the order is not correct in my opinion. This is what I see right now (of a total of 214 recordings):

Top 5 results:
- recording from 10/19/16
- recording from 10/20/16
- recording from 10/20/16
- recording from 11/8/16
- recording from 10/20/16

Bottom 5 results:
- recording from 10/16/16
- recording from 10/19/16
- recording from 10/20/16
- recording from 10/18/16
- recording from 10/17/16

As you can see, all dates are totally mixed up. It's practically impossible to find a recording this way.
No thank you for the suggestion!

Ok so maybe I don't have enough recordings to see this clearly. I do see what you are saying. It was just confusing for me because I tested your change for this and the order didn't change at all for me.

Can you PM me the entire files that you changed for this so I can be sure I am not missing something?

Thanks
 

mhancoc7

m7
Staff member
Aug 2, 2015
1,742
12
38
m7kodi.dev
I have updated USTVnow Plus with both suggested changes. #2 has already been pushed. #1 will be pushed in the next version soon.

Thanks again!