|
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
|
|||
|
|||
Test if MediaFile exists
Supposed I have a reference to a MediaFile object, and this file gets delete by DeleteFile().
Is there any simple method which can tell me if the reference I have is still in the database, pointing to an existing file ? I tried a few methods of the MediaFile API, but all worked as if the file still existed. I am currently calling GetMediaFiles() again and do a lookup, but I am wondering if there is a less expensive approach ... Thanks, Dirk |
#2
|
||||
|
||||
You said you tried a few calls... what have you tried? GetSize()? GetSegmentsFiles()? I think the default STV just does a refresh after deleting a file.
- 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. |
#3
|
||||
|
||||
How about:
GetMediaFileForID(GetMediaFileID(DeletedMediaFile)) (returns null if the ID of the DeletedMediaFile is not in the DB) Alternatively GetMediaFileSize(DeletedMediaFile)==0 (but I dont know what this does if the file still exists, but is on an offline drive)
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki |
#4
|
|||
|
|||
Couldn't you use IsFilePath in the Utility class?
BobP. Edit: Think I mis-understood the problem - sorry. Last edited by BobPhoenix; 05-23-2006 at 09:12 AM. |
#5
|
||||
|
||||
Quote:
- 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. |
#6
|
|||
|
|||
Quote:
I'll also try the other suggestions posted here, thanks again to everyone ! Dirk |
#7
|
||||
|
||||
I'm told that a lot of the MediaFile info is cached, but GetSize() checks the file size at the moment it is called. As Niel mentioned, you probably won't get a good response on offline files.
You can also do the check on the file segments, but offline files won't exist there either, so GetSize may be all that is needed. Due to the possibility of files being offline, I would make sure to only remove the item from your list as opposed to trying to get SageTV to remove actually it via any further deletion. - 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. |
#8
|
|||
|
|||
Quote:
Quote:
Thanks again, Dirk |
#9
|
||||
|
||||
Maybe I'm missing something, but if you just want to know whether the file still exists on disk, it seems like the most authoritative test would be
Code:
java_io_File_exists(GetFileForSegment(MediaFile, 0))
__________________
-- Greg |
#10
|
||||
|
||||
Quote:
To access any files that the server manages, such as recordings, you have to use the API file access calls to make sure a client will be able to 'see' it correctly. I added a blurb about this to the last couple pages of the v5 Studio manual... since I had to do a whole bunch of fixes for the default STV, I figured it would be good for others to know about. - 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. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|