![]() |
|
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. |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Any well to tell when Sage Is importing new media?
I am wondering if there is an easy way to tell when Sage is scanning for new media (the period check it does be it 2 hours or whatever the setting). I would like to fire off a scan of my own when it is finished. If it is in the API I missed it I am sure
![]() TIA skye |
#2
|
||||
|
||||
Quote:
Be careful when you use this method because if you start calling MediaFileMetadata apis on this newly added file, then it may trigger sagetv to call your plugin again, and result in an endless loop. (bmt 3.0 had that issue)
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient Last edited by stuckless; 02-17-2010 at 04:14 PM. |
#3
|
||||
|
||||
Check the stock UI, it puts up an icon when a scan is going on.
|
#4
|
|||
|
|||
Quote:
I am not calling mediafilemetadata apis so I should be okay then. Thanks will give this a look better than writing the route I was going and loaded a class at startup. |
#5
|
|||
|
|||
Hey Sean,
Having a issue here. Does it want a runnable clase like the load_atstartup does? It throws this error when trying to load Code:
Error instantiating metadata parser plugin of:java.lang.ClassCastException: smm.LoadSMMWorker cannot be cast to sage.MediaFileMetadataParser The wierd thing is is does show my logging like it is working after that error. Also after checking not sure this is the way I want to go as it calls this class on every video file it is importing correct? I more or less just need to have mine call once after importing is finished. |
#6
|
||||
|
||||
Your class needs to implement the sage.MediaFileMetadataParser
Code:
public class LoadSMMWorker implements sage.MediaFileMetadataParser { }
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#7
|
||||
|
||||
Quote:
For bmt, in 4.0, I allow the user to specify which file types they want to handle in the automatic metadata plugin. This won't help you much today... but in phoenix, there is an EventBus, where developers can subscribe to certain events. Currently there is an event that is fired each time a new MediaFile is successfully added to the wiz.bin. I'm actually using this model in the automatic plugin. ie, I register an event handler for media and the automatic plugin simple fires the event that then later gets picked up by the event handlers. This allows me to background process the requests instead of having them block, like they do in 3.x.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#8
|
|||
|
|||
Quote:
![]() While I got your attention since that is the route I am going for now. It is my understanding that by using setDaemon(true) and making my thread a demon thread it will automatically be killed when the sage service stops. Also it is my understanding that it will automatically be started when the sage service starts regardless of when SageTV Ui instance starts. Is that correct? The reason I ask is because I see no logging happening when the sagetv service starts but do see the entry starting the thread when a instance of sagetv starts. thanks again |
#9
|
||||
|
||||
Check out the MediaFilesImported hook. It provides a list of newly imported files too.
- 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. |
#10
|
|||
|
|||
Quote:
My simple thought there is start the thread and in run have a Code:
while(true){ try { Thread.sleep(amount of time to wait between scans); } catch (InterruptedException ex) { System.out.println("daemonServer: sleep exception: " + ex);} Run my code} |
#11
|
||||
|
||||
Quote:
Any time you can leverage an existing hook instead of writing your own thread and thread monitoring, you'll be better off. ie, using the medailfe metadata parser plugin hook would be a better than managing your own thread, since sage is going to configure a directory scanning intervalue, etc. You don't want too many independant threads all doing file scans. If you do ahead with your own thread, then be sure to research how to manage the shutdown of your thread... ie, while (true) is not good. Also research the InterruptedException, since you are expected to handle it correctly if you catch it.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#12
|
|||
|
|||
Quote:
The problem with the mediafile parser class it that it would call my searching for every single video file when I only need it called once after finished not for every video file. (I am checking a sql database on this call nothing to do with sagedb just need it ran at a regular interval). I am reading up on InterruptedException now seems simple to handle it. Again my goal is also not to screw anything up and if I am still misunderstanding or going about this wrong please don't hesitate to let me know ![]() |
#13
|
||||
|
||||
If you create threads, then you can prevent the jvm from cleanly shutting down. ie, the jvm exits when all threads are exited. Sometimes this can be as simple as adding a shutdown hook that notifies your thread to exit.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#14
|
||||
|
||||
Is there a way you can sync up your sql database one record at a time? So sage finds a new file, and it then handles creating the data in your sql?
__________________
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 |
#15
|
|||
|
|||
Quote:
Quote:
nothing is ever easy ![]() |
#16
|
|||
|
|||
Also should mention that I am not actually writing to the wiz.bin in this process so I guess that is why it doesn't make sense for me to do it per file.
|
#17
|
|||
|
|||
I use a background thread running in the server that waits on a serial blocking queue, and I use the metadata plugin call to drop an object onto the queue and process getting the metadata and inserting the data into the database in that background thread, so it doesn't hold up any of the normal sage processing...
Thanks, Jeff |
#18
|
||||
|
||||
Plucky, something else to consider, rather than managing your own thread, is to use the java Timer and TimerTask. What you are trying to do, is basicly why these classes were added to the java standard library.
The simple use case is something like this... Code:
TimerTask task = new TimerTask() { public void run() { /// check for new files, and add them to the database } } Timer timer = new Timer(true); time.schedule(task, Calendar.getInstance().getTime(), (60*60*1000)); For more information on the Timer check out the javadoc.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#19
|
|||
|
|||
Quote:
Thanks again Sean for all your willingness to help me out when I need it. |
#20
|
|||
|
|||
This part of the java doc scares me a bit
"After the last live reference to a Timer object goes away and all outstanding tasks have completed execution, the timer's task execution thread terminates gracefully (and becomes subject to garbage collection). However, this can take arbitrarily long to occur. By default, the task execution thread does not run as a daemon thread, so it is capable of keeping an application from terminating. If a caller wants to terminate a timer's task execution thread rapidly, the caller should invoke the the timer's cancel method. " I don't want my scanning to keep sage service from being able to shut down if it is in the process where as the deamon thread I am running now just gets killed regardless if it is in process or not. Of course it may be arbitrary because at max I don't see my process running more than 20seconds for a total rebuild.... Still reading ![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Why do files still show up in Media Center when I'm not importing them anymore?!?! | Chriscic | SageTV Software | 5 | 09-08-2008 11:57 AM |
What is the process for importing media from PCs on network? | sashimi | SageTV Software | 3 | 08-28-2008 07:12 PM |
Importing media | Mike | SageTV Software | 4 | 12-22-2006 04:43 PM |
Importing Media Files | mkriger | SageTV Media Extender | 2 | 06-02-2006 09:09 PM |
Help importing media: does Sage even read the properties file? | silkshadow | SageTV Software | 9 | 04-05-2006 10:47 AM |