Author Topic: How to change "viewed" flag by script  (Read 9339 times)

0 Members and 1 Guest are viewing this topic.

Offline Nautilus2067

  • User
  • ***
  • Posts: 74
    • View Profile
How to change "viewed" flag by script
« 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

Offline afrocuban

  • Moderator
  • *****
  • Posts: 444
    • View Profile
Re: How to change "viewed" flag by script
« Reply #1 on: May 14, 2013, 04:28:59 pm »
-1?

Offline Nautilus2067

  • User
  • ***
  • Posts: 74
    • View Profile
Re: How to change "viewed" flag by script
« Reply #2 on: May 14, 2013, 05:03:08 pm »
Nope, doesn't seem to work.

Offline afrocuban

  • Moderator
  • *****
  • Posts: 444
    • View Profile
Re: How to change "viewed" flag by script
« Reply #3 on: May 14, 2013, 05:07:54 pm »
"Minus one"? It should. Unfortunately, I have no ideas left.

Offline Nautilus2067

  • User
  • ***
  • Posts: 74
    • View Profile
Re: How to change "viewed" flag by script
« Reply #4 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...

Offline Nautilus2067

  • User
  • ***
  • Posts: 74
    • View Profile
Re: How to change "viewed" flag by script
« Reply #5 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( )?

Offline Nautilus2067

  • User
  • ***
  • Posts: 74
    • View Profile
Re: How to change "viewed" flag by script
« Reply #6 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.

Offline Nautilus2067

  • User
  • ***
  • Posts: 74
    • View Profile
Re: How to change "viewed" flag by script
« Reply #7 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!

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: How to change "viewed" flag by script
« Reply #8 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
Gentlemen, you can’t fight in here! This is the War Room!

Offline Nautilus2067

  • User
  • ***
  • Posts: 74
    • View Profile
Re: How to change "viewed" flag by script
« Reply #9 on: May 17, 2013, 10:12:03 pm »
Works perfectly. Thanks!