Personal Video Database

English => Development => Topic started by: Nautilus2067 on May 14, 2013, 04:00:37 pm

Title: How to change "viewed" flag by script
Post by: Nautilus2067 on May 14, 2013, 04:00:37 pm
Hi there,

I have just finished my draft version of an .nfo import script to import locally saved meta data (from MediaPortal). The watch status is stored separately in a small XML file beside every movie. I have succeded to read that file but using the AddFieldValueXML( ) function on the field "viewed" does not change the viewed flag.

Is it possible to change that field via script? If yes, how can it be done? I tried "true" and "false" as well as "0" and "1". Nothing worked.

Thanks for your help.

Oliver
Title: Re: How to change "viewed" flag by script
Post by: afrocuban on May 14, 2013, 04:28:59 pm
-1?
Title: Re: How to change "viewed" flag by script
Post by: Nautilus2067 on May 14, 2013, 05:03:08 pm
Nope, doesn't seem to work.
Title: Re: How to change "viewed" flag by script
Post by: afrocuban on May 14, 2013, 05:07:54 pm
"Minus one"? It should. Unfortunately, I have no ideas left.
Title: Re: How to change "viewed" flag by script
Post by: Nautilus2067 on May 14, 2013, 05:10:03 pm
Why -1 instead of 1? Do you know that? I can set the "viewdate" successfully, but not the "viewed" flag. hmmm...
Title: Re: How to change "viewed" flag by script
Post by: Nautilus2067 on May 14, 2013, 05:24:46 pm
Just to be sure:

AddFieldValueXML( 'viewed', '-1' );
AddFieldValueXML( 'viewed', '1' );
AddFieldValueXML( 'viewed', '0' );
AddFieldValueXML( 'viewed', 'True' );
AddFieldValueXML( 'viewed', 'true' );
AddFieldValueXML( 'viewed', ' ' );

This is the command I am using. I replaced all variables by direct values. None of the variants works. Maybe it's because of the data type. The flag is boolean. Same as "wish" and "loan". "wish" doesn't work either.
Does anybody know the field number so I can try the deprecated command:
AddFieldValue( )?
Title: Re: How to change "viewed" flag by script
Post by: Nautilus2067 on May 14, 2013, 05:37:57 pm
-1 and 0 should be the correct values because they work with custom fields. We may have a bug here.
Title: Re: How to change "viewed" flag by script
Post by: Nautilus2067 on May 14, 2013, 09:21:32 pm
The Field number is 36. So I have tried

Code: [Select]
AddFieldValue( 36, '-1' );
That didn't work either.

I am frustrated!
Title: Re: How to change "viewed" flag by script
Post by: nostra on May 17, 2013, 09:48:34 pm
It works actually, but the problem is that the script can't overwrite the default value as there is no option in Settings -> Plugins for this field.
You can find your script in pvdconf.ini with an equal sing and lots of numbers ones mostly. You can switch all of them to twos or for the viewed field the 36th one.
Smth like this:
Code: [Select]
AllMovie.com.psf=22222222222222222222222222222222222222222222222222222222222222222222222222222222
Title: Re: How to change "viewed" flag by script
Post by: Nautilus2067 on May 17, 2013, 10:12:03 pm
Works perfectly. Thanks!