Page 1 of 1
Podcast auto reload
Posted: Sun Oct 31, 2010 9:05 am
by S@gittarius
I am trying to make an Internet podcast to be reloaded on schedule but so far in vain. I’d like to have it refreshed on server/program’s startup. Doing so on demand from TV and from the podcast’s context menu are the only ways I found so far.
- How to achieve that?
- How to reload a podcast by a script?
Regards.
Re: Podcast auto reload
Posted: Mon Nov 01, 2010 8:37 am
by Eugene
Script to update some podcast feed
Code: Select all
function FindFolder(aItem: TWmsScriptMediaItem; const aTitlePath: string): TWmsScriptMediaItem;
var
i, j: Integer;
sTitle: string;
begin
Result := nil;
if aItem.HasChildItems then begin
i := Pos('\', aTitlePath);
if i > 0 then
sTitle := Copy(aTitlePath, 1, i - 1)
else
sTitle := aTitlePath;
for j := 0 to aItem.ChildCount - 1 do
if SameText(aItem.ChildItems[j].Properties[mpiTitle], sTitle) then begin
if i > 0 then
Result := FindFolder(aItem.ChildItems[j], Copy(aTitlePath, i + 1, Length(aTitlePath)))
else
Result := aItem.ChildItems[j];
Break
end
end
end;
var
PodcastItem: TWmsScriptMediaItem;
begin
PodcastItem := FindFolder(WmsFindMediaFolder(mfVideoPodcastsFolderItemID, ''), 'Hulu\Channels\Comedy');
if PodcastItem <> nil then begin
PodcastItem.RetrieveProperties;
WmsDatabaseAutoSave
end
end.
Re: Podcast auto reload
Posted: Mon Nov 01, 2010 11:59 am
by S@gittarius
Eugene wrote:Script to update some podcast feed
Code: Select all
function FindFolder(aItem: TWmsScriptMediaItem; const aTitlePath: string): TWmsScriptMediaItem;
var
i, j: Integer;
sTitle: string;
begin
Result := nil;
if aItem.HasChildItems then begin
i := Pos('\', aTitlePath);
if i > 0 then
sTitle := Copy(aTitlePath, 1, i - 1)
else
sTitle := aTitlePath;
for j := 0 to aItem.ChildCount - 1 do
if SameText(aItem.ChildItems[j].Properties[mpiTitle], sTitle) then begin
if i > 0 then
Result := FindFolder(aItem.ChildItems[j], Copy(aTitlePath, i + 1, Length(aTitlePath)))
else
Result := aItem.ChildItems[j];
Break
end
end
end;
var
PodcastItem: TWmsScriptMediaItem;
begin
PodcastItem := FindFolder(WmsFindMediaFolder(mfVideoPodcastsFolderItemID, ''), 'Hulu\Channels\Comedy');
if PodcastItem <> nil then begin
PodcastItem.RetrieveProperties;
WmsDatabaseAutoSave
end
end.
10x
I'll give it a try.
Regards
Re: Podcast auto reload
Posted: Tue Nov 16, 2010 9:03 am
by S@gittarius
Hi Eugene,
I am experiencing a little problem while updating resource database as follows. I have podcast folders generated by script which dynamically adds/removes items. To be clearer let’s say you have a “Last week” folder where you add items from the last 7 days (if they aren’t already there) for a specific resource (Youtube subscription) and remove items which are older than 1 week. One would ask what all is about. The reason for using such a script is that Youtube does not provide such functionality through its API. So everything works find while manually updating the podcast from its context menu. Now when I invoke the update from the script above WMS stops responding on instruction
and the only way out of the situation is to kill the process. I found through testing that removing items from target folder causes the problem under <...>.RetrieveProperties procedure. In the same time there is no problem adding new items.
The main goal is to make a script which is to be executed on schedule for updating such dynamic folders.
Regards.
Re: Podcast auto reload
Posted: Thu Nov 18, 2010 8:56 am
by Eugene
Hi,
S@gittarius wrote:I am experiencing a little problem while updating resource database as follows. I have podcast folders generated by script which dynamically adds/removes items. To be clearer let’s say you have a “Last week” folder where you add items from the last 7 days (if they aren’t already there) for a specific resource (Youtube subscription) and remove items which are older than 1 week. One would ask what all is about. The reason for using such a script is that Youtube does not provide such functionality through its API. So everything works find while manually updating the podcast from its context menu. Now when I invoke the update from the script above WMS stops responding on instruction
and the only way out of the situation is to kill the process. I found through testing that removing items from target folder causes the problem under <...>.RetrieveProperties procedure. In the same time there is no problem adding new items.
The main goal is to make a script which is to be executed on schedule for updating such dynamic folders.
I need a sample script to reproduce the problem.
Re: Podcast auto reload
Posted: Thu Nov 18, 2010 6:41 pm
by S@gittarius
Eugene wrote:Hi,
S@gittarius wrote:I am experiencing a little problem while updating resource database as follows. I have podcast folders generated by script which dynamically adds/removes items. To be clearer let’s say you have a “Last week” folder where you add items from the last 7 days (if they aren’t already there) for a specific resource (Youtube subscription) and remove items which are older than 1 week. One would ask what all is about. The reason for using such a script is that Youtube does not provide such functionality through its API. So everything works find while manually updating the podcast from its context menu. Now when I invoke the update from the script above WMS stops responding on instruction
and the only way out of the situation is to kill the process. I found through testing that removing items from target folder causes the problem under <...>.RetrieveProperties procedure. In the same time there is no problem adding new items.
The main goal is to make a script which is to be executed on schedule for updating such dynamic folders.
I need a sample script to reproduce the problem.
Hi,
Please try to execute the following from within "Script reading list of resources"
Code: Select all
FolderItem.Sort('-mpCreateDate');
//Purge oldest items
dtOldestTime := IncMonth(Now, -7);
for i := FolderItem.ChildCount - 1 downto 0 do begin
if dtOldestTime > strtodatetime(FolderItem.ChildItems[i].Properties[mpiCreateDate]) then FolderItem.ChildItems[i].Delete
else break;
end
Program does stop responding on
Regards,
Re: Podcast auto reload
Posted: Thu Nov 18, 2010 7:35 pm
by Eugene
S@gittarius wrote:Eugene wrote:Hi,
S@gittarius wrote:I am experiencing a little problem while updating resource database as follows. I have podcast folders generated by script which dynamically adds/removes items. To be clearer let’s say you have a “Last week” folder where you add items from the last 7 days (if they aren’t already there) for a specific resource (Youtube subscription) and remove items which are older than 1 week. One would ask what all is about. The reason for using such a script is that Youtube does not provide such functionality through its API. So everything works find while manually updating the podcast from its context menu. Now when I invoke the update from the script above WMS stops responding on instruction
and the only way out of the situation is to kill the process. I found through testing that removing items from target folder causes the problem under <...>.RetrieveProperties procedure. In the same time there is no problem adding new items.
The main goal is to make a script which is to be executed on schedule for updating such dynamic folders.
I need a sample script to reproduce the problem.
Hi,
Please try to execute the following from within "Script reading list of resources"
Code: Select all
FolderItem.Sort('-mpCreateDate');
//Purge oldest items
dtOldestTime := IncMonth(Now, -7);
for i := FolderItem.ChildCount - 1 downto 0 do begin
if dtOldestTime > strtodatetime(FolderItem.ChildItems[i].Properties[mpiCreateDate]) then FolderItem.ChildItems[i].Delete
else break;
end
Program does stop responding on
Regards,
try
Code: Select all
iChildCount := FolderItem.ChildCount;
for i := iChildCount - 1 downto 0 do
Not everything is working properly, but AV is not happening.
Re: Podcast auto reload
Posted: Thu Nov 18, 2010 8:10 pm
by S@gittarius
I gave it a try but with no success. To be clearer I invoke it through Settings -> Media-resources -> Processing where I’ve put your script to find the podcast and set a button on the main form. The actual script which does the problem is under podcast’s “Script reading list of resources” property. So when I press the button on the main form your script finds the podcast and invokes the second piece of code which goes well and adds new items if there are any to be added and then freezes on .Delete procedure.
Regards
Re: Podcast auto reload
Posted: Fri Nov 19, 2010 8:36 am
by Eugene
I checked in “Script reading list of resources”
Re: Podcast auto reload
Posted: Wed Nov 24, 2010 6:51 am
by S@gittarius
Hi,
Any update on the subject?
Regards