SageTV Community  

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

Notices

SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI.

Reply
 
Thread Tools Search this Thread Display Modes
  #21  
Old 07-07-2009, 09:16 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Post

Quote:
Originally Posted by PLUCKYHD View Post
My only question to this is going to be a simple on how would your append/add more tags to the existing is this possible with the current api?
Probably the most simplest way would be something like...
Code:
SetMediaFileMetadata("MediaTags",GetMediaFileMetadata(";MyTag;"l"))
But your really need "management" of the tags. ie, how to remove a tag... or before you add a new tag, check to see if that tag already exists, check for null, etc. Eventually, once phoenix gets to that point, it will have a tag api, but for now, you'll have to brute force it...

Code:
// check if tags exists
Tags = GetMediaFileMetadata("MediaTags")
if Tags not null 
   exists = java_lang_String_contains(Tags, ";MyTag;"")
endif

// remove a tag
if Tags not null
   Tags = java_lang_String_replaceAll(Tags, ";MyTag;","")
endif

// Adding a Tag
if Tags not null
   exists = java_lang_String_contains(Tags, ";MyTag;"")
   if !exists 
      SetMediaFileMetadata("MediaTags", Tags + ";MyTag;")
   endif
else
   SetMediaFileMetadata("MediaTags", ";MyTag;")
endif
Notice the null checks... if you don't use them, then your stv will generate many NullPointerExceptions and logging out those exceptions are expensive (performance wise)
Reply With Quote
  #22  
Old 07-07-2009, 11:22 AM
MeInMaui's Avatar
MeInMaui MeInMaui is offline
SageTVaholic
 
Join Date: Feb 2005
Location: Maui. HI
Posts: 4,203
The DataUnion() api call can be used to easily add new items to the MediaTag list. This automatically handles duplicates and nulls. I also agree with everything else stuckless said.

Code:
Tags = GetMediaFileMetadata("MediaTags")
Tags = DataUnion( Tags, ";MyTag;" )
SetMediaFileMetadata("MediaTags", Tags )
Aloha,
Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full."
- Nikolaus (4yrs old)

Last edited by MeInMaui; 07-07-2009 at 11:25 AM.
Reply With Quote
  #23  
Old 07-07-2009, 11:31 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Wouldn't DataUnion() need to have the data as an Array or Collection? And it returns a Vector. I'm not sure what the result of SetMediaFileMetadata("MediaTags", Vector) would be? Will that work?
Reply With Quote
  #24  
Old 07-07-2009, 11:37 AM
MeInMaui's Avatar
MeInMaui MeInMaui is offline
SageTVaholic
 
Join Date: Feb 2005
Location: Maui. HI
Posts: 4,203
Sorry, it's early here. I wasn't thinking. The Get/SetMediafileMetadata() call returns/expects a string, so some conversion would be required.

Aloha,
Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full."
- Nikolaus (4yrs old)
Reply With Quote
  #25  
Old 07-07-2009, 11:55 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by MeInMaui View Post
Sorry, it's early here. I wasn't thinking. The Get/SetMediafileMetadata() call returns/expects a string, so some conversion would be required.

Aloha,
Mike
Thanks for the suggestion making an array and then adding it makes sense to me.
Reply With Quote
  #26  
Old 07-07-2009, 03:31 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
I was not trying to suggest any sort of 'windows only' solution, where sage would actively use the windows tags, but more a crossover app that would sync windows and sage tags. While tagging would be a nice feature for video, it is a necessity for photo.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #27  
Old 07-17-2009, 10:11 AM
briands briands is offline
Sage Icon
 
Join Date: Aug 2004
Location: Bloomington, IN
Posts: 1,093
Any thought on adding a "most recently watched time" field to the database? Setting would be set to current time whenever watched flag is set. This would allow (I think) a better method for managing deletion of files. Particularly those that people will watch repeatedly (think kids shows or syndicated sit coms).
Reply With Quote
  #28  
Old 07-17-2009, 10:14 AM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
I think you can already do that, or at least I remember having a theory about doing that with the "stock" data in the database.
Reply With Quote
  #29  
Old 07-17-2009, 10:19 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Just for people that want to know I am using MediaTags with everyone suggestion and they work great in my latest build.
Reply With Quote
  #30  
Old 07-17-2009, 11:07 AM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
Quote:
Originally Posted by briands View Post
Any thought on adding a "most recently watched time" field to the database? Setting would be set to current time whenever watched flag is set. This would allow (I think) a better method for managing deletion of files. Particularly those that people will watch repeatedly (think kids shows or syndicated sit coms).
You already have access to that in the stock db...

GetRealWatchedStartTime()
GetRealWatchedEndTime()

http://download.sage.tv/api/sage/api...sage.Airing%29

That being said I don't know if the deletion manager uses this (i would assume it would though, but you know what they say about assumptions... ).
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer
Reply With Quote
  #31  
Old 07-17-2009, 12:08 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by razrsharpe View Post
You already have access to that in the stock db...

GetRealWatchedStartTime()
GetRealWatchedEndTime()

http://download.sage.tv/api/sage/api...sage.Airing%29

That being said I don't know if the deletion manager uses this (i would assume it would though, but you know what they say about assumptions... ).

Also don't know if that works for dvds (haven't tested) don't know why it would it doesn't work for formatdescription or watched
Reply With Quote
  #32  
Old 07-17-2009, 12:49 PM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
Quote:
Originally Posted by PLUCKYHD View Post
Also don't know if that works for dvds (haven't tested) don't know why it would it doesn't work for formatdescription or watched
ya the format description thing really irks me... for dvds there is no good data (relating to the video)... i think you can get the audio info with some GetAudioSoundtracks or something... i just dont get it.
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer
Reply With Quote
  #33  
Old 07-17-2009, 02:21 PM
briands briands is offline
Sage Icon
 
Join Date: Aug 2004
Location: Bloomington, IN
Posts: 1,093
Quote:
Originally Posted by razrsharpe View Post
You already have access to that in the stock db...

GetRealWatchedStartTime()
GetRealWatchedEndTime()

http://download.sage.tv/api/sage/api...sage.Airing%29

That being said I don't know if the deletion manager uses this (i would assume it would though, but you know what they say about assumptions... ).
I don't think this will work because neither is really an indication that the show is "Watched" only the the file has been started -GetRealWatchedStartTime() and stopped -GetRealWatchedEndTime().

.... sorry this will become disjointed thinking out loud from this point...

My thought was for a special favorite type - keep at least N episodes
The theory to implement was to store the watched time and toggle the watched flag OFF to prevent auto deletion as well as to allow for re-recording in the future. Then we would need a process to identify those to delete based on the Keep at MOST and the watched time.


...
think think think
...

I guess you could use the Watched flag AND this time to determine the most recently watched for deletion - then make sure the watched flag is unset at the same time you delete the file thus allowing it to be re-recorded in the future.

Lets see...

Set favorite to record first run and reruns
Set favorite to keep until I delete
Set keep at most to N+ some number
Keep at least N - need to store this some place too - associated with the favorite, not to mention a way to enter the value

Process for delete - only need to process when number of episodes >= "keep at most" AND there is an episode to consider for recording.

Determine the most recently watched episode of the favorite (that is currently recorded)

Compare watched time from the episode in the guide against the most recently watched episode currently recorded. If the guide episode is "older" then delete the recorded file - clear the watched flag on the deleted episode.

If the new recording HAS BEEN WATCHED - set the watched flag. This will make it easier to pick the never watched episodes.

Any thoughts on how to prevent a recording conflict... don't want a previously watched episode to prevent recording of a first run of a lower ranked favorite - or even an IR

What do these two calls return if the episode has not been watched?
....

Grrrrr... I really wish Sage would just implement the KEEP AT LEAST setting...

Sorry... that went pretty off topic....

Last edited by briands; 07-17-2009 at 02:23 PM.
Reply With Quote
  #34  
Old 07-17-2009, 02:29 PM
Tiki's Avatar
Tiki Tiki is offline
Sage Icon
 
Join Date: Feb 2005
Location: Southwest Florida, USA
Posts: 2,009
Quote:
Originally Posted by razrsharpe View Post
ya the format description thing really irks me... for dvds there is no good data (relating to the video)... i think you can get the audio info with some GetAudioSoundtracks or something... i just dont get it.
I assume you are referring to the API call:
GetMediaFileFormatDescription()

I suspect this doesn't work with DVD's (and ripped DVD's or Blue Rays) for the same reason that the Watched status doesn't work. It is because DVD's do not need to be a single linear file like most other video formats. They aren't even stored in a single file (usually), but spread out over multiple files. DVD's can store multiple movies on a single disk and break them up into chapters and "titles". They can also contain extra features like movie trailers, menus, and still images - each of which can be encoded in different formats (resolutions, bit rates, audio quality etc.). And, they even support interactive DVD's - there are DVD Games that you can "play" on a regular DVD player, where playback jumps around all over the place based on what buttons you press on the remote.

So, Sage can remember exactly where you are in a given DVD (title, chapter, and position within the chapter) and it can tell you the format information of whatever it is playing back at the moment. But, it can't tell you the format of the whole disk because there may be multiple formats used, and just because your current watch position is near the end of a given title, it doesn't know if you've watched all of the titles and chapters.

Just consider the case where you rip a movie DVD. If you've watched the main movie all the way through the credits, but you didn't watch the "deleted scenes", should Sage mark the movie as "watched"? What if you watched all of the "Extras", but not the main movie? And, how would Sage know for sure if you were watching the main movie or one of the extras?
__________________
Server: Ryzen 2400G with integrated graphics, ASRock X470 Taichi Motherboard, HDMI output to Vizio 1080p LCD, Win10-64Bit (Professional), 16GB RAM
Capture Devices (7 tuners): Colossus (x1), HDHR Prime (x2)
,USBUIRT (multi-zone)
Source:
Comcast/Xfinity X1 Cable
Primary Client: Server Other Clients: (1) HD200, (1) HD300
Retired Equipment: MediaMVP, PVR150 (x2), PVR150MCE,
HDHR, HVR-2250, HD-PVR
Reply With Quote
  #35  
Old 07-17-2009, 02:31 PM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
Quote:
Originally Posted by briands View Post
I don't think this will work because neither is really an indication that the show is "Watched" only the the file has been started -GetRealWatchedStartTime() and stopped -GetRealWatchedEndTime().
Quote:
What do these two calls return if the episode has not been watched?
they return the last time (in real time) that the airing was watched (start or end) regardless of what the watched status is. So you would need to combine it with IsWatched() to get the true LastWatched time (like you eluded too)

Quote:
Grrrrr... I really wish Sage would just implement the KEEP AT LEAST setting...
bingo...
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer
Reply With Quote
  #36  
Old 07-28-2009, 04:03 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
For those interested thanks to Razors help getting started, I have got some of the tagging coding done in my external Jar file. I will try and get it uploaded if other want to use it. I thought maybe this could help stuckless focus on other things on the to do list (cough music fanart cough )
Reply With Quote
  #37  
Old 07-28-2009, 04:06 PM
evilpenguin's Avatar
evilpenguin evilpenguin is offline
SageTVaholic
 
Join Date: Aug 2003
Location: Seattle, WA
Posts: 3,696
Sounds great! What kind of speed/performance are you seeing with tag based sorting or large collections?
Reply With Quote
  #38  
Old 07-28-2009, 04:10 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by evilpenguin View Post
Sounds great! What kind of speed/performance are you seeing with tag based sorting or large collections?
So far I haven't seen any issues a little slower than category grouping (which I do my own way inside the jar as well) but we are talking milliseconds.

The tagging seems to work really well and the coding for my first time in eclipse and such seems to work spot on and I am amazed how easy eclipse is to use to be honest once you figure it out it greatly expands the possibilites
Reply With Quote
  #39  
Old 07-28-2009, 04:21 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by evilpenguin View Post
Sounds great! What kind of speed/performance are you seeing with tag based sorting or large collections?
large collections forgot that part of the question I have a tester with over 1000 videos so i will be able to make sure the speed is there and that is what got me starting to make it external.

Currently with his collection I can do extremem filtering on menuload, build categorie groups,build tagging groups, build array of fanart for categories and tagging groups in about 1:30 but I think once I change over to all these new calls I can cut that drastically down hoping to get around 30 seconds max although faster would be ideal. considering I go through the collection about 6 times during load he is the perfect tester
Reply With Quote
  #40  
Old 07-28-2009, 04:42 PM
evilpenguin's Avatar
evilpenguin evilpenguin is offline
SageTVaholic
 
Join Date: Aug 2003
Location: Seattle, WA
Posts: 3,696
I made this a while ago, but just gave it to the Phoenix guys, maybe you'll find it useful too...


Basically, its a self-extracting archive that contains a directory structure with 1000+ organized TV Episodes complete with metadata and fanart. Really its just the same tiny video and pictures renamed and copied 3000+ times, but when you import the directory into Sage it'll think you have a massive imported TV library.

Be warned, the file is only 2 mb but it extracts to 1.5 GB so make sure you've got the space.

Last edited by evilpenguin; 07-28-2009 at 04:45 PM.
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
Details about metadata properties files Opus4 SageTV Customizations 37 11-06-2011 05:00 PM
New arbitrary metadata discussion Ikarius SageMC Custom Interface 41 04-06-2009 12:51 PM
.properties, .my, and TV metadata in SageMC himay SageMC Custom Interface 1 05-26-2008 09:43 PM
6.1.4 Metadata Properties Parsing JREkiwi SageTV Beta Test Software 35 03-10-2007 08:39 PM


All times are GMT -6. The time now is 03:51 AM.


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