Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Assets not being Added #209

Closed
cabsports opened this issue Jun 30, 2014 · 6 comments
Closed

New Assets not being Added #209

cabsports opened this issue Jun 30, 2014 · 6 comments

Comments

@cabsports
Copy link

Hi There,

I am new to Screenly OSE and I am trying to get setup for a bit of advertising in our club.

I have setup as schedule to add some new assets for a bit of a test. As you can see in the image before I have two assets turned on for a week and and inactive asset "Steak2" setup for 2:45PM until 2:50PM
before

After 2:45PM the image never shows on the display, below is the log file.
Mon, 30 Jun 2014 14:45:07 Last update: 2014-06-30 10:53:12.173304
Mon, 30 Jun 2014 14:45:07 get_next_asset
Mon, 30 Jun 2014 14:45:07 refresh_playlist
Mon, 30 Jun 2014 14:45:07 refresh: counter: (0) deadline (2014-07-03 00:39:00) timecur (2014-06-30 04:45:07.209528)
Mon, 30 Jun 2014 14:45:07 get_next_asset after refresh
Mon, 30 Jun 2014 14:45:07 get_next_asset counter 0 returning asset 1 of 2
Mon, 30 Jun 2014 14:45:07 Showing asset Coffee (image)
Mon, 30 Jun 2014 14:45:07 Asset URI /home/pi/screenly_assets/145f6d06174749bba5945cfe125caeef
Mon, 30 Jun 2014 14:45:07 Already showing file:///tmp/screenly_html/black_page.html, keeping it.
Mon, 30 Jun 2014 14:45:07 Sleeping for 10
Mon, 30 Jun 2014 14:45:17 Last update: 2014-06-30 10:53:12.173304
Mon, 30 Jun 2014 14:45:17 get_next_asset
Mon, 30 Jun 2014 14:45:17 refresh_playlist
Mon, 30 Jun 2014 14:45:17 refresh: counter: (0) deadline (2014-07-03 00:39:00) timecur (2014-06-30 04:45:17.267812)
Mon, 30 Jun 2014 14:45:17 get_next_asset after refresh
Mon, 30 Jun 2014 14:45:17 get_next_asset counter 0 returning asset 2 of 2
Mon, 30 Jun 2014 14:45:17 Showing asset Cafe Oz - Coffee & Cake (image)
Mon, 30 Jun 2014 14:45:17 Asset URI /home/pi/screenly_assets/3efb7df4f846493dbcfb9bb0c03cf493
Mon, 30 Jun 2014 14:45:17 Already showing file:///tmp/screenly_html/black_page.html, keeping it.
Mon, 30 Jun 2014 14:45:17 Sleeping for 10

I then go back to the webpage and click on refresh the Asset is moved to being active and it then is shown on the display and in the log file.
after

Mon, 30 Jun 2014 14:47:48 Last update: 2014-06-30 10:53:12.173304
Mon, 30 Jun 2014 14:47:48 get_next_asset
Mon, 30 Jun 2014 14:47:48 refresh_playlist
Mon, 30 Jun 2014 14:47:48 refresh: counter: (0) deadline (2014-07-03 00:39:00) timecur (2014-06-30 04:47:48.060111)
Mon, 30 Jun 2014 14:47:48 updating playlist due to database modification
Mon, 30 Jun 2014 14:47:48 update_playlist
Mon, 30 Jun 2014 14:47:48 Generating asset-list...
Mon, 30 Jun 2014 14:47:48 generate_asset_list deadline: 2014-06-30 04:50:00
Mon, 30 Jun 2014 14:47:48 update_playlist done, count 3, counter 0, index 0, deadline 2014-06-30 04:50:00
Mon, 30 Jun 2014 14:47:48 get_next_asset after refresh
Mon, 30 Jun 2014 14:47:48 get_next_asset counter 0 returning asset 1 of 3
Mon, 30 Jun 2014 14:47:48 Showing asset Coffee (image)
Mon, 30 Jun 2014 14:47:48 Asset URI /home/pi/screenly_assets/145f6d06174749bba5945cfe125caeef
Mon, 30 Jun 2014 14:47:48 Already showing file:///tmp/screenly_html/black_page.html, keeping it.
Mon, 30 Jun 2014 14:47:48 Sleeping for 10
Mon, 30 Jun 2014 14:47:58 Last update: 2014-06-30 10:53:12.173304
Mon, 30 Jun 2014 14:47:58 get_next_asset
Mon, 30 Jun 2014 14:47:58 refresh_playlist
Mon, 30 Jun 2014 14:47:58 refresh: counter: (0) deadline (2014-06-30 04:50:00) timecur (2014-06-30 04:47:58.121203)
Mon, 30 Jun 2014 14:47:58 get_next_asset after refresh
Mon, 30 Jun 2014 14:47:58 get_next_asset counter 0 returning asset 2 of 3
Mon, 30 Jun 2014 14:47:58 Showing asset Steak2 (image)
Mon, 30 Jun 2014 14:47:58 Asset URI /home/pi/screenly_assets/8373385a2b454f94a4c3c8c5bba88247
Mon, 30 Jun 2014 14:47:58 Already showing file:///tmp/screenly_html/black_page.html, keeping it.
Mon, 30 Jun 2014 14:47:58 Sleeping for 10

Is there something I am doing wrong or is there a bug in the code?

Thanks
Duncan

@richard-to
Copy link
Contributor

@cabsports

I was able to reproduce the bug following your steps.

I noticed that the viewer does not call: Generating asset-list... until after you refreshed the page

I think the bug may be here in viewer.py:

def refresh_playlist(self):
        logging.debug('refresh_playlist')
        time_cur = datetime.utcnow()
        logging.debug('refresh: counter: (%s) deadline (%s) timecur (%s)', self.counter, self.deadline, time_cur)
        if self.get_db_mtime() > self.last_update_db_mtime:
            logging.debug('updating playlist due to database modification')
            self.update_playlist()
        elif settings['shuffle_playlist'] and self.counter >= 5:
            self.update_playlist()
        elif self.deadline and self.deadline <= time_cur:
            self.update_playlist()

Looks like none of those conditions are met for this use case, and thus the playlist is not checked for active assets? In the case of refreshing the page, looks like that probably triggers a database update.

This seems like a common use case, so I think I am missing something. @vpetersson can give more information.

@cabsports
Copy link
Author

@richard-to

Thanks for that. I have been looking through a bit of the code and the variable "self.deadline" seems to be so far in advance it never triggers the last else if statement.

By looking at the code if I set it to shuffle then it should work, but that is not exactly what I want to do.

@richard-to
Copy link
Contributor

@cabsports

Yeah, that is strange. I wonder how the deadline is calculated. From the log, I assume it would be the earliest end date of your currently enabled and active assets: 2014-07-03 00:39:00, but that is not correct. Could be the dates are stored in GMT/UTC in the database. Yeah, looks like the the playlist only includes currently active assets.

Maybe deadline needs to include enabled and inactive assets? So in that case the deadline should be 2014-06-30 04:45:00 instead. Here for inactive assets, would need to use start date value

@cabsports
Copy link
Author

@richard-to

I agree it is only looking at the active assets and it is in UTC time, because my Time Zone is UTC +10 that would make sense.

The deadline date is generated in the "generate_asset_list" procedure using end_date in the playlist.

I think It needs some sort of if statement to check active by end date and non active by start date. What do you think @vpetersson

@brainrake
Copy link
Contributor

The deadline for refreshing the playlist didn't take into account assets starting in the future, only end_dates of assets. This is fixed in the above commit.
The web interface still needs to be refreshed to see the changes, but the screen will display the correct assets.

@cabsports
Copy link
Author

@brainrape Thank-you so much for fixing this issue so quickly! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants