Author Topic: Folder Loader plugin  (Read 26817 times)

AndyDeGroo

  • Guest
Folder Loader plugin
« on: October 20, 2014, 10:00:17 PM »
This is my first plugin for RadioDJ and also happens to be my first project written in C#.Net.

The idea came about after replying to a post by PHAZE FM. He needed to clear a category and then import all files from a directory into that category. Unfortunately, RadioDJ does not have this functionality. That is until I decided to create a plugin which can do exactly that.

Folder Loader plugin adds two event actions for use in scheduled events:
  • Clear Subcategory – deletes songs from a subcategory specified by category and subcategory name or ID as argument. It will delete song records from database, so it’s up to users to decide if it suits their needs.
  • Load Files From Folder – imports all supported file formats from a directory, placing them in a subcategory, assigning genre and track type specified by name or ID as arguments.
Example action for importing tracks from "C:\News\" into main category "News", subcategory "Latest News",  assign "News" genre and set type to "News":
Code: [Select]
PluginAction|Folder Loader|Load Files From Folder|C:\News\;cat=News&subcat=Latest News&genre=News&type=News
NOTE: cat and genre parameters are optional.

Since version 2.0.1.0:
If genre is set to AutoGenre, plugin will try to read genre from ID3 tags. This may slow down import process.
Cue point data can be imported from file ID3 tags (if saved previously) using ID3cue=yes.
Do not add the ID3cue parameter, since plugin checks for its presence, not its value. Reading cue data from ID3 tags also slows down the import process.

e.g. to import tracks with cue points and genres from ID3 tags, action would be:
Code: [Select]
PluginAction|Folder Loader|Load Files From Folder|C:\News\;cat=News&subcat=Latest News&type=News&genre=AutoGenre&ID3cue=yes
There is just one option in plugin settings – Recurse subfolders. If enabled, plugin will scan for files in all subdirectories of specified directory.
I've tested the plugin as much as I could, but there could be some bugs. Test it on your secondary system to see if it fits your requirements.

You should back up your database because Clear Subcategory action will delete songs from database. Although the plugin checks if specified subcategory exists before deleting songs and does nothing if the subcategory can't be found by name or ID.

Usual disclaimer: Folder Loader plugin is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

[Download link no longer available]

PLEASE READ CHANGELOG BEFORE USING NEW VERSION (2.0.0.1 and up)!

FAQ
Q: Does it import duplicates if tracks are already in database?
A: No. It checks if track already exists using same functions RadioDJ is using to do that.

Q: Does it delete files from disk?
A: No.

Q: Does it give milk?
A: Maybe. If you ask politely. :)

Current version: 2.0.1.0
Last updated: 2015-04-26 06:17 GMT

Changelog:
2.0.1.0
  • Enhancement: Optionally read CUE data from file ID3/meta tags (enabled using parameter ID3cue=yes)
  • Enhancement: Optionally read genre from file ID3/meta tags (enabled using parameter genre=AutoGenre)
  • Enhancement: Plugin will create the specified genre if it doesn't exist (unless genre is set to AutoGenre)

2.0.0.2
  • Now compatible with RadioDJ 1.7.7 and 1.7.8
For previous RadioDJ versions: [Download link no longer available]

2.0.0.1
  • Completely reworked how arguments are specified
  • OPTIONALLY Main category can be specified using cat=Category Name. (Make sure that category exists or no tracks will be imported)
  • Subcategory can be specified using subcat=Subcategory Name. (Make sure that subcategory exists or no tracks will be imported)
  • OPTIONALLY Genre can be specified using genre=Genre Name.
  • Track type can be specified using type=Music. (It must be one of types supported by RadioDJ or it will be set to Music)
Categories, subcategories and genres will not be created by the plugin, so they must exists or it will not work. I'm planning to add it if enough users request that feature.

Time spent on latest version: 6 hours

1.0.0.1
  • Importing runs in a separate thread to avoid blocking main interface
  • Added checking for incorrect or empty arguments
Kudos to Marius for testing and advice.

1.0.0.2
  • More checks for empty or incorrect arguments
  • Checks if folder path exists and logs error to events log if path can't be found

1.0.0.0
First working version created in about 4 hours.
Runs on main thread and blocks RadioDJ interface during folder import.

Marius

  • Administrator
  • Hero Member

  • Offline
  • *****
  • 5291
    • Radio DJ Romania
Re: Folder Loader plugin
« Reply #1 on: October 20, 2014, 10:10:39 PM »
Great job Andy, as always!  ;)
DOWNLOADS PAGE

HOW TO FIX RADIODJ DATABASE
----------------
Please don't PM me for support requests. Use the forums instead.

Jhonny

  • Hero Member

  • Offline
  • *****
  • 3175
  • Personal Text
    Peace, enjoy life.it's over before you've lived it
    • Jhonny's RadioDJ tutorials.
Re: Folder Loader plugin
« Reply #2 on: October 21, 2014, 12:41:01 PM »
Tested, it's  :cool:

Gr. J
R.T.F.M. means to me, Read The Fantastic Messages.
Make things simple, but don't make simple things simpler!
I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit https://dj-jhonny.nl

Pegbars

  • Guest
Re: Folder Loader plugin
« Reply #3 on: October 21, 2014, 02:23:58 PM »
Andy, you are amazing, sir!
 :ok:

shyzas

  • New User

  • Offline
  • *
  • 6
Re: Folder Loader plugin
« Reply #4 on: October 21, 2014, 05:02:50 PM »
Hello, nice plugin, exactly what i was looking for.
Small suggestion. Maybe there whould be more logical clearing, specifying by category@subcategory (as on adding folder), than anly by subcategory.
Thank You!

AndyDeGroo

  • Guest
Re: Folder Loader plugin
« Reply #5 on: October 21, 2014, 09:03:09 PM »
Small suggestion. Maybe there whould be more logical clearing, specifying by category@subcategory (as on adding folder), than anly by subcategory.
I thought that RadioDJ didn't allow to add more than one subcategory with same name. Apparently I was wrong. I'll add this option in upcoming version.

Jhonny

  • Hero Member

  • Offline
  • *****
  • 3175
  • Personal Text
    Peace, enjoy life.it's over before you've lived it
    • Jhonny's RadioDJ tutorials.
Re: Folder Loader plugin
« Reply #6 on: November 12, 2014, 04:42:35 PM »
I do not know what's wrong.
 Using the plugin in an event rdj crashes.
 This is in version 175.

In the version 173 it worked  and thought it worked to in version 174.
Am I the only one?

Update.

I found this.

Description:
   stopped working

 Files that help to describe the problem:
   C: \ Users \ opa Jan \ AppData \ Local \ Temp \ WER8FB9.tmp.WERInternalMetadata.xml
   C: \ Users \ opa Jan \ AppData \ Local \ Temp \ WERD7FF.tmp.mdmp

 Read the privacy statement online:
   http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0413

 If the online privacy statement is not available, please read our privacy statement offline:
   C: \ Windows \ system32 \ en-US \ erofflps.txt
R.T.F.M. means to me, Read The Fantastic Messages.
Make things simple, but don't make simple things simpler!
I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit https://dj-jhonny.nl

AndyDeGroo

  • Guest
Re: Folder Loader plugin
« Reply #7 on: November 12, 2014, 10:45:21 PM »
I do not know what's wrong.
 Using the plugin in an event rdj crashes.
 This is in version 175.

In the version 173 it worked  and thought it worked to in version 174.
Am I the only one?

Update.

I found this.

Description:
   stopped working
(...)

Thanks for reporting, Jhonny. Unfortunately, the info is not helpful. Can you please check event logs for any messages around the time RadioDJ crashed?

Jhonny

  • Hero Member

  • Offline
  • *****
  • 3175
  • Personal Text
    Peace, enjoy life.it's over before you've lived it
    • Jhonny's RadioDJ tutorials.
Re: Folder Loader plugin
« Reply #8 on: November 12, 2014, 11:22:08 PM »
I find this.

Description:
   stopped working

 Problem Signature:
   Problem Event Name: clr20r3
   Problem Signature 01: radiodj.exe
   Problem Signature 02: 1.7.5.0
   Problem Signature 03: 5434d8ab
   Problem Signature 04: Plugin_FolderLoader
   Problem Signature 05: 1.0.0.2
   Problem Signature 06: 5445546c
   Problem Signature 07: 1b
   Problem Signature 08: 0
   Problem Signature 09: System.IndexOutOfRangeException
   OS Version: 6.1.7601.2.1.0.768.3
   Locale ID: 1043

 Read the privacy statement online:
   http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0413

 If the online privacy statement is not available, please read our privacy statement offline:
   C: \ Windows \ system32 \ en-US \ erofflps.txt

or.
- System

   - Provider

    [Name] Windows Error Reporting
 
   - EventID 1001

    [Qualifiers] 0
 
    Level 4
 
    Task 0
 
    keywords 0x80000000000000
 
   - Time Created

    [System Time] 2014-11-12T15: 56: 39.000000000Z
 
    EventRecordID 71 779
 
    Channel Application
 
    Computer grandfather Jan PC
 
    Security
 

 - Event Data

    126816013
    22
    clr20r3
    Not available
    0
    radiodj.exe
    1.7.5.0
    5434d8ab
    Plugin_FolderLoader
    1.0.0.2
    5445546c
    1b
    0
    System.IndexOutOfRangeException
   
    C: \ Users \ grandfather Jan \ AppData \ Local \ Temp \ WER8FB9.tmp.WERInternalMetadata.xml C: \ Users \ grandfather Jan \ AppData \ Local \ Temp \ WERD7FF.tmp.mdmp
   C:\Users\opa-jan\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_radiodj.exe_83cb79276750eed4ae0c4f7a930edb9b450de4_025cafc6
   
    0
    41bc3f29-6a84-11e4-996c-000272af08aa
    9th
R.T.F.M. means to me, Read The Fantastic Messages.
Make things simple, but don't make simple things simpler!
I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit https://dj-jhonny.nl

Jhonny

  • Hero Member

  • Offline
  • *****
  • 3175
  • Personal Text
    Peace, enjoy life.it's over before you've lived it
    • Jhonny's RadioDJ tutorials.
Re: Folder Loader plugin
« Reply #9 on: November 13, 2014, 09:46:36 AM »
I'm very sorry, forgot the argument field to fill in with the category name. :bash:

Jh.

Ps. Now I can finish the tut for the plug-in.
R.T.F.M. means to me, Read The Fantastic Messages.
Make things simple, but don't make simple things simpler!
I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit https://dj-jhonny.nl

Jhonny

  • Hero Member

  • Offline
  • *****
  • 3175
  • Personal Text
    Peace, enjoy life.it's over before you've lived it
    • Jhonny's RadioDJ tutorials.
Re: Folder Loader plugin
« Reply #10 on: November 13, 2014, 09:59:20 AM »
I read only talk about subcategories.
 But what is the main category?
 Will there be no mistake if you have two subcategories with the same name?

Jh.
R.T.F.M. means to me, Read The Fantastic Messages.
Make things simple, but don't make simple things simpler!
I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit https://dj-jhonny.nl

AndyDeGroo

  • Guest
Re: Folder Loader plugin
« Reply #11 on: November 13, 2014, 04:15:09 PM »
It might throw an exception if the category was not specified. I'll add checks to avoid this issue and upload an updated version.
The option to specify main category was already requested by shyzas and I'm going to add that in this iteration.

elsilva0

  • Guest
Re: Folder Loader plugin
« Reply #12 on: November 14, 2014, 11:10:03 PM »
Congratulaaaations for this job!  :cool:

I agree with Jhonny bout categories, and i gonna wait for the uptade :)

Quote
Current version imports all files as track type "Music", but I could add a global option to choose different track type or allow to specify another argument in event action.
I would like using it here in my station when it s using all others track types, like jingle, news, podcast, variable duration file, newest from folder,  and file by date. these last five very important IMHO, imagine, you just copi new files or download to the folder (I never download to radiodj folders but some guys do it) well, imagine, u paste the new files inside the ur specific folder, then it will be all u have to do, once u ve schedule the folder loader plugin to clear the subgaterorie (which to me is like category) and genre (To me its almost like a subcategory).


Think the possibilities...


Your station is a Top-40 station, then every week u get new songs playing on ur station.

Now with folder loader... You only put the new songs at the "TOP40" folder with other already there in.
schedule folder loader to clear and import around the 03:00 and 03:05
 (I hope radio dj doesnt craashes down if a top40 category in this folder called in mainplaylist, because it will not be found in database for 5 minutes, maybe it can be in 1 minute left, i don't know)

 Can it be schedule right at the same time Andy?

Okay, u understood. Now think with me, you have a news station, or station with news or podcasts...

You have a folder named like podcasts or news, or news show etc...

everyday u dodwnload new files or record it.

now with this folder loader, you r only gonna put the new news, podcasts, news shows, etc and schedule the same way doin at the top40 above.

Folder loader will clear ur sub-category right at the 03:00 am (for exmple) and then add files from the same folder again, then itll add the file was not there some days ago, but now some hours ago uve put it inside this folder, and itll be added to database right to that subcategory  ;D


Awesome, it just needs u Andy to make it better yet, and it will be all of us very happy, the possibilities are ...


 :ok:



AndyDeGroo

  • Guest
Re: Folder Loader plugin
« Reply #13 on: November 15, 2014, 07:14:15 AM »
schedule folder loader to clear and import around the 03:00 and 03:05
 (I hope radio dj doesnt craashes down if a top40 category in this folder called in mainplaylist, because it will not be found in database for 5 minutes, maybe it can be in 1 minute left, i don't know)

 Can it be schedule right at the same time Andy?
No, RadioDJ should not crash if the category was empty when using the category for song selection. It might log an error message about not being able to select tracks if the category is empty. The category entry itself is not deleted, but the songs are. You should know that all song data is lost by using the clear subcategory action, so play count, cue data and everything else goes. You should not use the action if all you want is add new songs from a directory. However, the plugin does not check if songs have been removed from the directory. That must be done using track verification.

You have a folder named like podcasts or news, or news show etc...

everyday u dodwnload new files or record it.

now with this folder loader, you r only gonna put the new news, podcasts, news shows, etc and schedule the same way doin at the top40 above.

Folder loader will clear ur sub-category right at the 03:00 am (for exmple) and then add files from the same folder again, then itll add the file was not there some days ago, but now some hours ago uve put it inside this folder, and itll be added to database right to that subcategory

Thanks for suggestions. I'll try to update the plugin in a day or two. I'm a little busy with other projects right now.

Yeah, I was going to add an option to select track type for assigning the music but I'm not sure yet how to better implement it. It could be added as global option in plugin's options windows but that is not useful for importing various track types. Better option would be to add it as optional argument for event action so users can select a different track type for every action.

Note that "newest from folder" would not work as intended if it was assigned to tracks with full file path. RadioDJ might fail and throw exception because it tried to access file as a directory when loading it.
It might also fail if Podcast, Internet Stream or File By Date track type were used for ordinary files.

elsilva0

  • Guest
Re: Folder Loader plugin
« Reply #14 on: November 15, 2014, 08:24:18 AM »
 :o  ??? No podcasts automatized, no newest from folder too  :huh: I already was getting happy in using these options in radio dj so soon :D now i came back to the beginin, made all actions for this by the old way  :hihi:

Anywayu i'll also be waiting for updates, whenever it comes  :cool: