Search found 5 matches

by dadelayer
08 Oct 2017, 19:41
Forum: Help and Support
Topic: Renaming file base on JSON list?
Replies: 6
Views: 16322

Re: Renaming file base on JSON list?

{ def inputFile = new File("F:/MEGA/SC MOVIES/1.json") def json = new groovy.json.JsonSlurper().parseText(inputFile.text) def scid = fn def name = json.find{ it.scid == scid }.title def year = json.find{ it.scid == scid }.year def rename = name + ' - ' + year } I'm new to Groovy so it might not be ...
by dadelayer
08 Oct 2017, 07:42
Forum: Help and Support
Topic: Renaming file base on JSON list?
Replies: 6
Views: 16322

Re: Renaming file base on JSON list?

e.g. { def json = new groovy.json.JsonSlurper().parseText('''[{"title":"The Little Hours","year":"2017","imdbid":"tt5666304","scid":"10080"}]''') def scid = fn // e.g. 10080.mp4 json.find{ it.scid == scid }.title } Now you just need to have JsonSlurper read from a File. ;) Thank you very much, that ...
by dadelayer
07 Oct 2017, 08:09
Forum: Help and Support
Topic: POSTBUCKET - where random posts in unrelated topics go
Replies: 1036
Views: 1103155

Re: Batch Rename any type of file

Well, I wanted to try it in XML since I wanted to use your example, but not coming up with anything. def fnn = fn xml = new XmlSlurper().parse(folder+'/mov.xml') xml.'**'.find { it.name() == 'scid' && it.text() == fnn}*.parent()*.title*.text() that should return the title but it's not working as its ...
by dadelayer
06 Oct 2017, 21:22
Forum: Help and Support
Topic: POSTBUCKET - where random posts in unrelated topics go
Replies: 1036
Views: 1103155

Re: Batch Rename any type of file

Thanks!. I tested it out using the example and it worked fine. However, when I use it with my XML file (I converted the JSON > XML), it says my format is not correct.
I use the same format and code as the example
by dadelayer
06 Oct 2017, 06:22
Forum: Help and Support
Topic: Renaming file base on JSON list?
Replies: 6
Views: 16322

Renaming file base on JSON list?

Is there a way to rename files based on a JSON list? For example I have something like this : [{"title":"The Little Hours","year":"2017","imdbid":"tt5666304","scid":"10080"},{"title":"CarGo","year":"2017","imdbid":"tt6680792","scid":"10079"},{"title":"My Little Pony: The Movie","year":"2017","imdbid ...