SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-26-2011, 07:52 AM
joshuad156 joshuad156 is offline
Sage User
 
Join Date: Feb 2010
Location: Ohio
Posts: 33
Help with Filtering MediaFile[]

I want to do something like

Code:
MediaList = FilterByMethod(MediaList, "GetChannelNumber", "1001", false)
to exclude all media files in an array that were aired on channel 1001, for example. However, this isn't working for me, I assume because GetChannelNubmer is not a method of MediaFile. Is there a simple way to do this without iterating through the array and building a new array with just the MediaFiles I want? I'd like to do this in Studio and keep it as simple as possible, but I can't seem to find an elegant solution to this one.
Reply With Quote
  #2  
Old 04-26-2011, 08:18 AM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
This works for me:

FilterByMethod(GetAllChannels(), "GetChannelNumber", "2", true)

So it only returns channel number 2.... but thats not what you want and I don't have any recordings on my test server but you maybe able to use:

FilterByMethod(MediaFiles, "GetAiringChannelNumber", "2", false)

Can't be sure though but worth a shot I guess.


EDIT

Actually that does work and I did have two recordings to try it with:

FilterByMethod(GetMediaFiles("T"), "GetAiringChannelNumber", "26", false)

Which returned one of my two recordings.
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders

Last edited by jaminben; 04-26-2011 at 08:25 AM.
Reply With Quote
  #3  
Old 04-26-2011, 07:35 PM
joshuad156 joshuad156 is offline
Sage User
 
Join Date: Feb 2010
Location: Ohio
Posts: 33
OK I feel stupid now. I have no idea why I couldn't get this to work initially, but now it's working fine. I think the fact that it's a MedaiFile and not an Airing scared me off too quickly. :-)

Perhaps it was because I used the wrong method initially. That's what I get for trying to do this at 2am!

Thanks!
Reply With Quote
  #4  
Old 04-27-2011, 06:54 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by joshuad156 View Post
OK I feel stupid now. I have no idea why I couldn't get this to work initially, but now it's working fine. I think the fact that it's a MedaiFile and not an Airing scared me off too quickly. :-)
Generally speaking, methods that accept an Airing Object will also accept a MediaFile Object, and vice versa. The core will automatically convert between MediaFile Object and Airing Object as needed.

Your initial example did not work because GetChannelNumber() needs a Channel Object and not a MediaFile or Airing.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #5  
Old 04-27-2011, 07:05 AM
joshuad156 joshuad156 is offline
Sage User
 
Join Date: Feb 2010
Location: Ohio
Posts: 33
Quote:
Originally Posted by tmiranda View Post
Generally speaking, methods that accept an Airing Object will also accept a MediaFile Object, and vice versa. The core will automatically convert between MediaFile Object and Airing Object as needed.
This is REALLY useful information to know! Reading through the API I don't remember seeing anything hinting at this. Thanks for that tip. I'm certain it will come in handy in the future.
Reply With Quote
  #6  
Old 04-27-2011, 08:16 AM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by joshuad156 View Post
This is REALLY useful information to know! Reading through the API I don't remember seeing anything hinting at this. Thanks for that tip. I'm certain it will come in handy in the future.
BTW: for future reference, this info is in the API docs and in the Studio PDF manual.

The docs for the two API calls shows these details for the return values and parameters:

public java.lang.String GetChannelNumber(sage.Channel Channel)
public java.lang.String GetAiringChannelNumber(sage.Airing Airing)

They both return strings, but one takes a Channel object parameter while the other needs an Airing.

SageTV's automatic conversion from one data type to another, when possible, is covered in the Studio manual on pages 16-17, including the example of converting Airing <--> MediaFile. If you haven't already read through the Studio manual and gone through the tutorials, you should do so.

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #7  
Old 04-27-2011, 02:45 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by Opus4 View Post
SageTV's automatic conversion from one data type to another, when possible, is covered in the Studio manual on pages 16-17, including the example of converting Airing <--> MediaFile.
Yes. It's also covered in the API JavaDocs if you read the first few paragraphs that describe the class.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
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
Filtering out vs filtering in Spectrum SageTV Beta Test Software 9 09-29-2010 11:34 AM
Sorting and Filtering Videos? can3gxw SageTV Beta Test Software 0 05-28-2010 02:28 AM
Filtering encrypted channels during DVB scans Lucas SageTV Beta Test Software 2 06-23-2009 04:27 PM
Filtering converted videos srothwell SageTV Software 3 12-14-2007 11:21 PM
Pre-filtering jeffoz1 Hardware Support 3 06-18-2003 07:46 PM


All times are GMT -6. The time now is 12:57 PM.


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