SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV v7 Customizations > Batch Metadata Tools
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

Batch Metadata Tools This forums is for discussing the user-created Batch Metadata Tools for SageTV.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-27-2011, 04:33 PM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
VFS - filter by a metadata field

I am trying to customize a BMT VFS view and it works until I add in a filter on metadata.

I tried an example I found on your google code site (VFSDocumentation)

The sample I found was....

Code:
<filter by="metadata">
   <option name="field" value="HDTV"/>
   <option name="value" value="true"/>
<filter/>
It fails when I reload the VFS in BMT with the following error...

Code:
Error in VFS File: .\userdata\Phoenix\vfs\movies.xml; Attribute "by" is required and must be specified for element type "filter".
I get the same error when trying what I really wanted to filter by which is DiscNumber...

Code:
<filter by="metadata">
   <option name="field" value="DiscNumber"/>
   <option name="value" value=""/>
<filter/>
Which of course fails in the same way.

Any ideas on what I am doing incorrect?

k
Reply With Quote
  #2  
Old 03-27-2011, 06:09 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by jusjoken View Post
I am trying to customize a BMT VFS view and it works until I add in a filter on metadata.

I tried an example I found on your google code site (VFSDocumentation)

The sample I found was....

Code:
<filter by="metadata">
   <option name="field" value="HDTV"/>
   <option name="value" value="true"/>
<filter/>
It fails when I reload the VFS in BMT with the following error...

Code:
Error in VFS File: .\userdata\Phoenix\vfs\movies.xml; Attribute "by" is required and must be specified for element type "filter".
I get the same error when trying what I really wanted to filter by which is DiscNumber...

Code:
<filter by="metadata">
   <option name="field" value="DiscNumber"/>
   <option name="value" value=""/>
<filter/>
Which of course fails in the same way.

Any ideas on what I am doing incorrect?

k
Could you post your entire movies.xml... it might be that it's not complaining about this particular filter. It looks correct to me.
Reply With Quote
  #3  
Old 03-27-2011, 06:33 PM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
Quote:
Originally Posted by stuckless View Post
Could you post your entire movies.xml... it might be that it's not complaining about this particular filter. It looks correct to me.
Sure... here it is...

Code:
<!DOCTYPE vfs SYSTEM "vfs.dtd">
<vfs>
	<views>
                <view name="my_movies" label="My Movies">
                        <tag value="video" />

			<!-- Grab all video files -->
                        <source name="mediafiles">
                                <option name="mediamask" value="VL"/>
                        </source>

			<!-- pull in recorded movies for this view as well -->
			<view-source name="recordedmovies"/>

			<!-- globally filter out TV files -->
			<filter by="mediatype" scope="exclude" value="TV"/>

			<!-- present then sorted by title -->
			<presentation level="1">
				<group by="title">
					<option name="prune-singe-item-groups" value="true"/>
				</group>
                                <sort by="title"/>
                        </presentation>
                </view>

                <view name="my_movies_no_disc_no" label="My Movies (no Disc #)">
                        <tag value="video" />

			<!-- Grab all video files -->
                        <source name="mediafiles">
                                <option name="mediamask" value="VL"/>
                        </source>

			<!-- pull in recorded movies for this view as well -->
			<view-source name="recordedmovies"/>

			<!-- globally filter out TV files -->
			<filter by="mediatype" scope="exclude" value="TV"/>

			<filter by="metadata">
			   <option name="field" value="DiscNumber"/>
			   <option name="value" value=""/>
			<filter/>

			<!-- present then sorted by title -->
			<presentation level="1">
				<group by="title">
					<option name="prune-singe-item-groups" value="true"/>
				</group>
                                <sort by="title"/>
                        </presentation>
                </view>


		<view name="my_movies_missingmetadataview" label="Missing Metadata for Movies">
			<description>Movies that are missing metadata</description>
			<tag value="metadata"/>
			<view-source name="my_movies"/>

			<filter by="missingmetadata"/>

			<presentation>
				<sort by="title"/>
			</presentation>
		</view>
	</views>
</vfs>
If I remove the filter by for metadata it works fine.

k
Reply With Quote
  #4  
Old 03-27-2011, 06:49 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
My bad. All my documentation has an xml formatting error

Code:
<filter by="metadata">
   <option name="field" value="DiscNumber"/>
   <option name="value" value=""/>
<filter/>
Should read...
Code:
<filter by="metadata">
   <option name="field" value="DiscNumber"/>
   <option name="value" value=""/>
</filter>
Reply With Quote
  #5  
Old 03-27-2011, 07:00 PM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
Quote:
Originally Posted by stuckless View Post
My bad. All my documentation has an xml formatting error

Code:
<filter by="metadata">
   <option name="field" value="DiscNumber"/>
   <option name="value" value=""/>
<filter/>
Should read...
Code:
<filter by="metadata">
   <option name="field" value="DiscNumber"/>
   <option name="value" value=""/>
</filter>
Thanks... I should have caught that... so now onto the next error...

Code:
Error in VFS File: .\userdata\Phoenix\vfs\movies.xml; The content of element type "view" must match "(option*,description?,tag*,source*,view-source*,filter?,presentation*)".
Thoughts?

k
Reply With Quote
  #6  
Old 03-27-2011, 07:22 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
The issue there is that you can not have multiple filters at the view level. This is programming limitation that I've been to busy to solve.

There is a way around it, though, you can define a filter in the filters section, like such...

Code:
<!DOCTYPE vfs SYSTEM "vfs.dtd">
<vfs>
	<filters>
                <item-group name="jusjoken-nodisc" label="TV Files without Disc" mode="and">
			<filter by="mediatype" scope="exclude" value="TV"/>

			<filter by="metadata">
			   <option name="field" value="DiscNumber"/>
			   <option name="value" value=""/>
			</filter>
                        <tag value="video"/>
                </item-group>           

	</filters>

	<views>
                <view name="my_movies" label="My Movies">
                        <tag value="video" />

			<!-- Grab all video files -->
                        <source name="mediafiles">
                                <option name="mediamask" value="VL"/>
                        </source>

			<!-- pull in recorded movies for this view as well -->
			<view-source name="recordedmovies"/>

			<!-- globally filter out TV files -->
			<filter by="mediatype" scope="exclude" value="TV"/>

			<!-- present then sorted by title -->
			<presentation level="1">
				<group by="title">
					<option name="prune-singe-item-groups" value="true"/>
				</group>
                                <sort by="title"/>
                        </presentation>
                </view>

                <view name="my_movies_no_disc_no" label="My Movies (no Disc #)">
                        <tag value="video" />

			<!-- Grab all video files -->
                        <source name="mediafiles">
                                <option name="mediamask" value="VL"/>
                        </source>

			<!-- pull in recorded movies for this view as well -->
			<view-source name="recordedmovies"/>

			<filter by="jusjoken-nodisc"/>

			<!-- present then sorted by title -->
			<presentation level="1">
				<group by="title">
					<option name="prune-singe-item-groups" value="true"/>
				</group>
                                <sort by="title"/>
                        </presentation>
                </view>


		<view name="my_movies_missingmetadataview" label="Missing Metadata for Movies">
			<description>Movies that are missing metadata</description>
			<tag value="metadata"/>
			<view-source name="my_movies"/>

			<filter by="missingmetadata"/>

			<presentation>
				<sort by="title"/>
			</presentation>
		</view>
	</views>
</vfs>
Reply With Quote
  #7  
Old 03-27-2011, 07:23 PM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
Quote:
Originally Posted by jusjoken View Post
Thanks... I should have caught that... so now onto the next error...

Code:
Error in VFS File: .\userdata\Phoenix\vfs\movies.xml; The content of element type "view" must match "(option*,description?,tag*,source*,view-source*,filter?,presentation*)".
Thoughts?

k
I think I solved this next error... seems like you cannot have 2 <filer> tags in one view. So I build a item-group under a <filers> section and it seems to work.

My view is not displaying what I want but I am sure I just need to figure the correct value to use for the DiscNumber filter. At least I am not getting an error.

Thanks
k
Reply With Quote
  #8  
Old 03-27-2011, 07:31 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by jusjoken View Post
I think I solved this next error... seems like you cannot have 2 <filer> tags in one view. So I build a item-group under a <filers> section and it seems to work.

My view is not displaying what I want but I am sure I just need to figure the correct value to use for the DiscNumber filter. At least I am not getting an error.

Thanks
k
DiscNumber is numeric, so you may want to try something like...

Code:
			<filter by="metadata">
			   <option name="field" value="DiscNumber"/>
			   <option name="value" value="0"/>
                           <option name="compare-numeric" value="true"/>
			</filter>
Any empty DiscNumber fields will have a value of 0 when asked for its numeric value.
Reply With Quote
  #9  
Old 03-28-2011, 09:02 AM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
I found a way to get what I was looking for but in the end I needed to use another view to be the source of my no disc view as I could not get a item-group filter to work if it contained a metadata filter. The metadata filter on it's own works fine but if it is part of a item-group filter it is ignored (or at least I think that is what is happening).

In the xml below I have 2 no disc views.

1. my_movies_no_disc_no - this one works as I use the my_movies view as a source and then add in the metadata based filter.

2. my_movies_no_disc_no2 - this one does not work but I think it should. It uses a item-group filter with the same metadata filter I used in 1 above but it seems to be ignored.

Code:
<!DOCTYPE vfs SYSTEM "vfs.dtd">
<vfs>

	<filters>
		<item-group name="nodisc" label="Filter Movies without Disc Number" mode="and">
		<!--
		-->
			<filter by="metadata" scope="exclude">
			   <option name="field" value="DiscNumber"/>
			   <option name="value" value="0"/>
                           <option name="compare-numeric" value="true"/>
			</filter>
			<filter by="homevideos" scope="exclude"/>
			<filter by="mediatype" scope="exclude" value="TV"/>

		</item-group>

		<item-group name="filterTVandHomeVideos" label="Filter TV and Home Videos" mode="and">
			<filter by="homevideos" scope="exclude"/>
			<filter by="mediatype" scope="exclude" value="TV"/>
		</item-group>

	</filters>

	<views>
                <view name="my_movies" label="My Movies">
                        <tag value="video" />

			<!-- Grab all video files -->
                        <source name="mediafiles">
                                <option name="mediamask" value="VL"/>
                        </source>

			<!-- pull in recorded movies for this view as well -->
			<view-source name="recordedmovies"/>

			<!-- globally filter out TV files -->
			<filter by="filterTVandHomeVideos"/>

			<!-- present then sorted by title -->
			<presentation level="1">
				<group by="title">
					<option name="prune-singe-item-groups" value="true"/>
				</group>
                                <sort by="title"/>
                        </presentation>
                </view>

                <view name="my_movies_no_disc_no" label="My Movies (no Disc #)">
                        <tag value="video" />

			<view-source name="my_movies"/>

			<filter by="metadata" scope="include">
			   <option name="field" value="DiscNumber"/>
			   <option name="value" value="0"/>
                           <option name="compare-numeric" value="true"/>
			</filter>

			<!-- present then sorted by title -->
			<presentation level="1">
				<group by="title">
					<option name="prune-singe-item-groups" value="true"/>
				</group>
                                <sort by="title"/>
                        </presentation>
                </view>


                <view name="my_movies_no_disc_no2" label="My Movies (no Disc #)2">
                        <tag value="video" />

			<!-- Grab all video files -->
                        <source name="mediafiles">
                                <option name="mediamask" value="VL"/>
                        </source>

			<!-- pull in recorded movies for this view as well -->
			<view-source name="recordedmovies"/>

			<!-- globally filter out TV files -->
			<filter by="nodisc"/>

			<!-- present then sorted by title -->
			<presentation level="1">
				<group by="title">
					<option name="prune-singe-item-groups" value="true"/>
				</group>
                                <sort by="title"/>
                        </presentation>
                </view>


		<view name="my_movies_missingmetadataview" label="Missing Metadata for Movies">
			<description>Movies that are missing metadata</description>
			<tag value="metadata"/>
			<view-source name="my_movies"/>

			<filter by="missingmetadata"/>

			<presentation>
				<sort by="title"/>
			</presentation>
		</view>


		<view name="my_movies_by year" label="My Movies by Year">
			<description>Movies by year</description>
			<tag value="metadata"/>
			<view-source name="videosgroupedbyyear"/>

			<filter by="filterTVandHomeVideos"/>

			<presentation>
				<group by="year">
					<option name="empty-foldername" value="No Year"/>
				</group>
				<sort by="title">
					<option name="sort-order" value="desc"/>
				</sort>
			</presentation>
			
			<presentation>
				<sort by="title">
					<option name="sort-order" value="asc"/>
				</sort>
			</presentation>

		</view>

	</views>
</vfs>
What I have is working for me so this post was more to see if I was doing something wrong in the item-group filter of if there is a bug affecting this.

k
Reply With Quote
  #10  
Old 03-28-2011, 09:36 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
From what I can see, I don't think the nodisc filter will do what you want. Filter groups are AND'ed or OR'ed together (in your case ANDed).

and each filter will either return true or false for each item (and that value will be negated if you use exclude).

So, to look at your nodisc filter...

Code:
			<filter by="metadata" scope="exclude">
			   <option name="field" value="DiscNumber"/>
			   <option name="value" value="0"/>
                           <option name="compare-numeric" value="true"/>
			</filter>
			<filter by="homevideos" scope="exclude"/>
			<filter by="mediatype" scope="exclude" value="TV"/>
So for the above filter... it will true true IF the disc in not 0 AND it's not a home movie AND it's not a TV show.

I think what you want is to return all videos that have a disc number of 0 AND not a home movie AND not TV.

so,
Code:
			<filter by="metadata" scope="include">
			   <option name="field" value="DiscNumber"/>
			   <option name="value" value="0"/>
                           <option name="compare-numeric" value="true"/>
			</filter>
			<filter by="homevideos" scope="exclude"/>
			<filter by="mediatype" scope="exclude" value="TV"/>
Reply With Quote
  #11  
Old 03-28-2011, 09:40 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
BTW... thanks for playing with this... the VFS is core to phoenix, so having people play with the views will help us to uncover issues, etc. Hopefully at somepoint, I'll make a web module for bmt for configuring views, and I think we'll have some support eventually in the STV to customize views as well. The views are quite powerful in that you can pretty much create a view for anything, but that also adds some complexity in the STV (and web ui) for building views, supporting all features, etc.
Reply With Quote
  #12  
Old 03-28-2011, 11:00 AM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
Quote:
Originally Posted by stuckless View Post
From what I can see, I don't think the nodisc filter will do what you want. Filter groups are AND'ed or OR'ed together (in your case ANDed).

and each filter will either return true or false for each item (and that value will be negated if you use exclude).

So, to look at your nodisc filter...

Code:
			<filter by="metadata" scope="exclude">
			   <option name="field" value="DiscNumber"/>
			   <option name="value" value="0"/>
                           <option name="compare-numeric" value="true"/>
			</filter>
			<filter by="homevideos" scope="exclude"/>
			<filter by="mediatype" scope="exclude" value="TV"/>
So for the above filter... it will true true IF the disc in not 0 AND it's not a home movie AND it's not a TV show.

I think what you want is to return all videos that have a disc number of 0 AND not a home movie AND not TV.

so,
Code:
			<filter by="metadata" scope="include">
			   <option name="field" value="DiscNumber"/>
			   <option name="value" value="0"/>
                           <option name="compare-numeric" value="true"/>
			</filter>
			<filter by="homevideos" scope="exclude"/>
			<filter by="mediatype" scope="exclude" value="TV"/>
You are correct and as you can see the approach that I took that worked (using another view as the source and then adding in a metadata filter directly to the view) used include. I made this change to the item-group filter but it still returns no results.

I am willing to try something else if you have more suggestions but my guess is the code that processes the metadata filter when it is within an item-group is not processing the metadata filter properly.

k
Reply With Quote
  #13  
Old 03-28-2011, 11:39 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
It could very be that there is an issue in the filter groups. I'll open an issue to look at the filter groups to see what I can see anything in there. I use a filter group for the missing metadata filter that also excludes home videos, and it works there, but maybe there is something odd in how the metadata one is working. Although given that that it works as a normal filter, I'm not sure why it would not work at intended in the filter group.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help: VFS ohpleaseno Phoenix 23 03-21-2011 09:11 AM
VFS Views - What's missing? stuckless Phoenix 20 03-12-2011 06:26 PM
VFS in Version 4.1.0 toricred Batch Metadata Tools 8 10-02-2010 10:54 AM
Date field missing on Sage 6 menu screens Sagebrush SageTV Software 3 05-03-2007 03:59 PM
Searching on the id3 tag comments field BBCritical SageTV Beta Test Software 9 12-05-2006 04:40 PM


All times are GMT -6. The time now is 07:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.