ignoreatstart not working

If you need any help with XBMC4XBOX, such as installing or using the software, please post it in here.
Post Reply
User avatar
Rocky5
Posts: 958
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 90 times
Been thanked: 248 times

ignoreatstart not working

Post by Rocky5 » Mon Jun 27, 2016 1:54 am

Was trying to Stop XBMC from creating resume points when playing videos, as the settings option doesn't work :? (if set to no it will create one anyways & just act like yes) now the advancedsettings.xml "<ignoreatstart>15</ignoreatstart>" doesn't seem to work either :shock:

So it would seem for the time being I need to delete the video.db after playback, to stop it from keep track.
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5

User avatar
Dan Dar3
Posts: 1157
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 251 times
Been thanked: 248 times
Contact:

Re: ignoreatstart not working

Post by Dan Dar3 » Tue Jun 28, 2016 9:00 pm

Hi Rocky5,

Just tested with an older version I can confirm your findigs - version 3.5.1 (r32990) / Confluence Lite (assumed you tested with latest 3.5.3 and this one of the older builds I had around).

Settings > Video > Playback > Resume from where last stopped doesn't seem to work as expected when set to No - it still creates the resume point and it resumes when played. Yes and Ask seem to be ok.

Checked Q:\UserData\guisettings.xml and <videoplayer> \ <resumeautomatically> seems to be changing when setting is changed through UI so the problem must be down the line when acting on the the value. Context menu for the video also says Resume when it shouldn't.

This must have been broken for a while, if you could raise a ticket it will help to track this issue further.

~~~~

Trying <video> \ <ignoreatstart> I found that when the Resume from where last stopped is set to Yes it appears to work correctly, if you play the first few seconds before the amount specified in advancedsettings.xml it will not create a resume point. BUT, if you had a resume point and you navigate back to say before the first XX seconds, it will not delete the resume point and it will resume from the older point (hope it makes sense). When set to No I just couldn't get it to create a resume point at all (I guess you could use this behaviour to achieve the "No resume" behaviour as an odd workaround?!) - I should note though that before testing I did skip the video all the way to the end to remove the resume point.

~~~~

I was going to suggest a bit of script to remove the resume points (bookmarks) but unfortunatelly the QueryVideoDatabase HTTP API doesn't seem to allow for DELETE statements, only SELECT.

Code: Select all

import xbmc
xbmc.executehttpapi("QueryVideoDatabase(DELETE FROM bookmark)") 

Code: Select all

20:43:27 M: 32571392   DEBUG: HttpApi Start command: QueryVideoDatabase  paras: QueryVideoDatabase; DELETE FROM bookmark
20:43:27 M: 32559104   ERROR: SQLite: MUST be select SQL!
20:43:27 M: 32559104   ERROR: CVideoDatabase::GetArbitraryQuery failed
But going straight at the database seems to work. It should be less dramatic workaround compared to deleting the entire video database.
You can have it running from autoexec.py at startup if you want:

Code: Select all

import sqlite3

videodb = xbmc.translatePath("special://database/MyVideos34.db")
connection = sqlite3.connect(videodb)
connection.cursor().execute("DELETE from bookmark")
connection.commit()
connection.close()

User avatar
Rocky5
Posts: 958
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 90 times
Been thanked: 248 times

Re: ignoreatstart not working

Post by Rocky5 » Tue Jun 28, 2016 11:28 pm

This isn't for the Library mode, and that script doesn't seem to work :( this is for my XBMC4Kids mod/skin and game preview videos, if you stop them half way through they resume & this isn't the intended behaviour, so removing the DB is fine for this instance.

Also trying your workaround, doesn't stop it from happening. I dont know if its because the file is played from the HDD directly.

Code: Select all

xbmc.playmedia($INFO[ListItem.Path,,_resources\artwork\preview].xmv,1)
&
xbmc.playmedia($INFO[ListItem.Path,,preview].xmv,1)
This is the script I currently use.

Code: Select all

######################################################################
# Script by Rocky5
# Used to delete the video.db so videos don't have a resume point.
# (It seems to be broken in XBMC 3.5.3)
######################################################################

import os, fileinput, time

# Sets paths, for profiles names & locations.
CurVideoDB = xbmc.translatePath( 'special://Database/MyVideos34.db' )

# Start markings for the log file.
print "================================================================================"
print "| CleanMyVideos34.db.py loaded."
print "| ------------------------------------------------------------------------------"

if os.path.isfile(CurVideoDB):
	time.sleep(1)
	os.remove(CurVideoDB)
	print "| MyVideos34.db removed."
	print "================================================================================"
else:
	print "| MyVideos34.db doesn't exist."
	print "================================================================================"
Does each profile need a "advancedsettings.xml" or does the master one work globally?
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5

User avatar
Dan Dar3
Posts: 1157
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 251 times
Been thanked: 248 times
Contact:

Re: ignoreatstart not working

Post by Dan Dar3 » Wed Jun 29, 2016 12:16 am

Library mode or file mode, it still uses the video database to store video information, and in this case to store the resume points for video media. I tested with a local HDD file as well.

I would have to check the source but I think there is only one advancedsettings.xml in Q:\UserData, here was mine I tested with:

Code: Select all

<?xml version="1.0"?>
<video>
  <ignoreatstart>15</ignoreatstart>
</video>
I'm a bit surprised my code didn't work, was there an error in xbmc.log? In the end doesn't really matter since you worked around it by deleting the video db and you're fine with that, I still think you should create a ticket for "Settings > Video > Playback > Resume from where last stopped" as it doesn't seem to work as expected.

User avatar
Rocky5
Posts: 958
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 90 times
Been thanked: 248 times

Re: ignoreatstart not working

Post by Rocky5 » Wed Jun 29, 2016 12:33 am

This is my AdvancedSettings.xml & scrolling a head in a video file will still resume if you stop the file & play it back. I'm using XBMC 3.5.3 official release.

Code: Select all

<advancedsettings>
	<loglevel hide="false">1</loglevel>
	<powersave>false</powersave>
	<nodvdrom>true</nodvdrom>
	<thumbsize>256x364</thumbsize>
	<fanartsize>853x480</fanartsize>
	<!-- <bginfoloadermaxthreads>5</bginfoloadermaxthreads> -->
	<video>
		<ignoreatstart>14400</ignoreatstart>
		<!-- <fullscreenonmoviestart>false</fullscreenonmoviestart> -->
	</video>
	<myprograms>
		<trainerpath>Q:\trainers\</trainerpath> 
	</myprograms>
	<pictures>
		<screenshotpath>Q:\Screenshots\</screenshotpath>
	</pictures>
</advancedsettings>
Sorry, I forgot the script does work but you need to add a delay of about 0.5 seconds or it doesn't remove the entry. (MyVideos34-journal is the cause)

I will use your script, credit where its due of cores.

Code: Select all

import sqlite3, time

videodb = xbmc.translatePath("special://database/MyVideos34.db")
time.sleep(0.5)
connection = sqlite3.connect(videodb)
connection.cursor().execute("DELETE from bookmark")
connection.commit()
connection.close()
Also added a ticket.
http://redmine.exotica.org.uk/issues/358
Last edited by Dan Dar3 on Sat Jul 09, 2016 5:46 pm, edited 1 time in total.
Reason: Adding bug ticket
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5

User avatar
Dan Dar3
Posts: 1157
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 251 times
Been thanked: 248 times
Contact:

Re: ignoreatstart not working

Post by Dan Dar3 » Sun Jul 10, 2016 1:15 pm

Had a look at the code and trying to recreate the issue I found a couple of things:
  1. If playing the video from the "Recently added movies" section (main screen at the top) it will always resume regardless of the value of the setting. I can look more into that and why was it coded that way, but it sounds like intended behaviour - you play the vide, you might want to resume it I guess - we'll see what we find.
  2. When playing from the Movies or Videos section, it does seem to respect the resume setting.
When I tried it first I did from the "Recently added movies" which would explain. How do play the videos yourself exactly?

User avatar
Rocky5
Posts: 958
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 90 times
Been thanked: 248 times

Re: ignoreatstart not working

Post by Rocky5 » Sun Jul 10, 2016 2:36 pm

They're played via a button press within the programs menu.

So outside of the video library. I haven't tested any other way of playing the video files, as that's no use to me as I need them to play how I do it.
(or it's pointless)

I may install an older version of XBMC (before 3.0) and test to see if playback is bookmarked if played the same way.
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5

User avatar
Dan Dar3
Posts: 1157
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 251 times
Been thanked: 248 times
Contact:

Re: ignoreatstart not working

Post by Dan Dar3 » Mon Jul 11, 2016 9:04 am

Testing with an older older version to see if it works with that, that's great, but I will need more details on the "button press within the programs menu" so I can replicate it.

User avatar
Rocky5
Posts: 958
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 90 times
Been thanked: 248 times

Re: ignoreatstart not working

Post by Rocky5 » Mon Jul 11, 2016 11:33 am

Dan Dar3 wrote:Testing with an older older version to see if it works with that, that's great, but I will need more details on the "button press within the programs menu" so I can replicate it.

I can send you the hole skin if you like? that way you can replicate it 100%

If not this is what is used to playback the video when in programs,games.

Code: Select all

<control type="button">
<posx>0</posx>
<posy>0</posy>
<onclick>xbmc.playmedia($INFO[ListItem.Path,,_resources\media\preview].mp4,1)</onclick>
</control>
If you watch a video, or skip say half way through it, it creates a bookmark/restore point.

In the latest incarnation of my skin, I do the playback via Python but same result.
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5

User avatar
Dan Dar3
Posts: 1157
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 251 times
Been thanked: 248 times
Contact:

Re: ignoreatstart not working

Post by Dan Dar3 » Mon Jul 11, 2016 3:47 pm

XBMC.PlayMedia(media,1) is a good start, if you want to send me the skin or the Python code to replicate it, that sounds good too (I think both will probably call the same built-in function but we could make sure).

User avatar
Dan Dar3
Posts: 1157
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 251 times
Been thanked: 248 times
Contact:

Re: ignoreatstart not working

Post by Dan Dar3 » Sat Oct 08, 2016 3:00 pm

@Rocky5
It has been a while, coming back to have another go at this.

I took your XBMC4Kids package down and "built" it. I can see the "Game Preview" (X) feature but not sure how to setup a video preview for it, if you could quickly guide me through how could I set up one to try, just to make sure I run it the same way as you do.

I can see there is skin settings section with "XBox Media Video", "VMW", "H.264" and "MPEG Video" choices as well as "Synopsis Mode" toggle. How is yours setup?

User avatar
Rocky5
Posts: 958
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 90 times
Been thanked: 248 times

Re: ignoreatstart not working

Post by Rocky5 » Sat Oct 08, 2016 5:32 pm

For synopsis mode it would be "Halo/_resources/media/preview.mp4"

For default mode it would be "Halo/preview.mp4"

The code to get the files is in the python script.

Also I use MPlayer for everything bar XMV, as DVDPlayer is the only player that plays them.

You will also need to rename the script that removes the bookmark, either on the HDD or the xml.


If you're wanting the same setup as me then you can download the "Game resource pack" at the bottom of the first post in the XBMC4Kids thread, this has everything setup for previews and synopsis.
( advent rising and a few others have default.xml and videos/screenshots )

Here is the link, save you some time.
https://drive.google.com/folderview?id= ... UlvSEhVRTg
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5

User avatar
Dan Dar3
Posts: 1157
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 251 times
Been thanked: 248 times
Contact:

Re: ignoreatstart not working

Post by Dan Dar3 » Sun Oct 09, 2016 12:48 am

Downloaded the game pack, none seem to have any video preview files but that's fine I can put any video in there and rename it preview.mp4.

I transfered the contents of the archive into F:\Games, then tried "Game Preview" (X) on Advent Rising and I got a "Could not find: Games/_resources/default.xml" on the left side and "No Video Found" and "No Screenshots Found" on the right (screenshot).

I believe all files are in place as they were in the archive, I note the error message is missing the drive from the location. I have the "Games" source containing "F:\Games". Any idea what migth be causing the error?

User avatar
Rocky5
Posts: 958
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 90 times
Been thanked: 248 times

Re: ignoreatstart not working

Post by Rocky5 » Sun Oct 09, 2016 11:54 am

Requires a default.xbe as it gets the path via ListItem.Path so the game has to be stored in the DB for that to work.

So
F:\Games\Advent Rising\
-- default.xbe
-- preview.xmv (change extension in settings)
-- _resources\
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5

User avatar
Dan Dar3
Posts: 1157
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 251 times
Been thanked: 248 times
Contact:

Re: ignoreatstart not working

Post by Dan Dar3 » Mon Oct 10, 2016 7:29 pm

Strangest thing, I set it up for one game (add the .xbe and the preview video) come back to the Games and that game disappears from the list - did it twice as I found it odd the first time.

I'll try the meantime XBMC.PlayMedia(media,1) from a Python script, see how that compares.

User avatar
Rocky5
Posts: 958
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 90 times
Been thanked: 248 times

Re: ignoreatstart not working

Post by Rocky5 » Mon Oct 10, 2016 8:31 pm

Dan Dar3 wrote:Strangest thing, I set it up for one game (add the .xbe and the preview video) come back to the Games and that game disappears from the list - did it twice as I found it odd the first time.

I'll try the meantime XBMC.PlayMedia(media,1) from a Python script, see how that compares.
Never had that issue, does the xbe have a title?

You could just use XBMC's default.xbe and remove the program6.db?

Or I could send you a couple folders all setup with videos and such?
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5

User avatar
Dan Dar3
Posts: 1157
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 251 times
Been thanked: 248 times
Contact:

Re: ignoreatstart not working

Post by Dan Dar3 » Mon Oct 10, 2016 9:11 pm

Never mind that, Rocky, not so important, I think I managed to replicate the issue and have an explanation for it as well.

I was able to replicate the issue by starting a video using the built-in XBMC.PlayMedia() method, similar to how it is called from the skin XML code (the preview = 1 parameter is irelevant to the issue):

Code: Select all

import xbmc
xbmc.executebuiltin('XBMC.PlayMedia(X:\\some_path\\some_video.mp4,1)') 
I've added some debug log statements to various places that seemed to revolve around video playback and resuming to find out with surprise that CGUIWindowVideoBase::OnResumeShowMenu() was called and because I guess this method was only expected to be called when it was to actually resume playback, it checks whether videoplayer.resumeautomatically is not RESUME_ASK (2) and it's not cause we set it to RESUME_NO (0). Therefore resumeItem becomes true, it'll find the bookmark and we'll have the video resumed, not the expected behaviour.

Code: Select all

bool CGUIWindowVideoBase::OnResumeShowMenu(CFileItem &item)
{
  // we always resume the movie if the user doesn't want us to ask
  bool resumeItem = g_guiSettings.GetInt("videoplayer.resumeautomatically") != RESUME_ASK;
  CLog::Log(LOGDEBUG,"[DD3] CGUIWindowVideoBase::OnResumeShowMenu() -> videoplayer.resumeautomatically = [%i], resumeItem = [%s]", g_guiSettings.GetInt("videoplayer.resumeautomatically"), ((int) resumeItem ? "true" : "false"));
  ...  
XBMC.PlayMedia() built-in function, to be able to give you similar functionality (resume if previously played) it defaults a variable used to check whether it should ask to resume with true, and based on that it will call CGUIWindowVideoBase::OnResumeShowMenu() directly and then since the sistem is not set to ask it will resume the video automatically as it will find the bookmark.

This doesn't happen when the play command is received through the GUI as the logic checks for videoplayer.resumeautomatically first and then it calls either OnResumeShowMenu() or CGUIMediaWindow::OnClick.

Finally, we have two solutions:
  1. Call the built-in function with an undocumented parameter to tell it to not resume, e.g. XBMC.PlayMedia(media,1,noresume)
  2. I have updated the Redmine ticket you created to propose a change to Builtins.cpp to fix the issue.

User avatar
Rocky5
Posts: 958
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 90 times
Been thanked: 248 times

Re: ignoreatstart not working

Post by Rocky5 » Tue Oct 11, 2016 8:35 am

I'm sure I tried noresume and it never worked. (Found it when I was going through the source code)

But will try again today at some point.

Update:
noresume works, thanks Dan Dar3.
(Im sure I tried this before, but it works now so all is good)
Last edited by Rocky5 on Thu Oct 13, 2016 12:25 pm, edited 1 time in total.
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5

User avatar
Dom DXecutioner
Posts: 585
Joined: Thu Jul 05, 2012 11:59 pm
Location: California
Has thanked: 249 times
Been thanked: 216 times
Contact:

Re: ignoreatstart not working

Post by Dom DXecutioner » Wed Oct 12, 2016 10:34 am

you've probably have already read this, still...

HOW-TO: Modify Automatic Watch and Resume Points
3.2 Prevent watch and resume points from being saved

If you don't want watched or resume points/marks saved automatically then you can use these values. Since it is impossible to playback a video at 101 percent, no mark is made. Watched marks can still be manually recorded using W on a keyboard, the context menu, or an add-on such as Add-on:Trakt. This only prevents new marks from being automatically added and won't remove existing marks in the database. To remove existing marks you can use W on a keyboard or the context menu.
advancedsettings.xml

Code: Select all

<advancedsettings>
  <video>
    <playcountminimumpercent>101</playcountminimumpercent>
    <ignorepercentatend>101</ignorepercentatend>
  </video>
</advancedsettings>
Image

Post Reply