Sponsored Content
Full Discussion: Help with refining script
Top Forums Shell Programming and Scripting Help with refining script Post 302988929 by Simplify on Thursday 5th of January 2017 07:52:23 AM
Old 01-05-2017
Linux New script requirement advise :)

Quote:
Originally Posted by bakunin
Yes! One more converted! ;-)

bakunin
Hi @bakunin

Ok, I have a new scripting requirement that I wanted to run by you...

I have a 3rd party script that pulls metadata from imdb.com and gives it to me in a clean text format. Now I need to modify the format and some of the fields to make the data ready for the next process I want to use it for - that is applying it to a mp4 file to so that my iTunes reads it correctly.

No, the question is - script in bash, ksh, sh or python? I think I would need to use grep or sed to manipulate the string i get from the 3rd party script output and if your suggestion is bash/ksh/sh then what do you suggest - grep or sed r a combination of both? OR do you think it could all be down via shell?

look forward to your thoughts

PS for anyone else reading, your thoughts and comments are welcome and sorry for going off topic - I would have sent bakunin a PM, however, i haven't posted 10 times yet...

Cheers,
Darren

---------- Post updated at 08:52 PM ---------- Previous update was at 08:30 PM ----------

Oh and I just thought about stomps comments - please see what I am attempting to accomplish below.

this is an output example I get from the 3rd party script (GitHub - bgr/imdb-cli: Command line tool for retrieving IMDb movie information)
Code:
Title:Deep Throat
Year:1993
Rated:TV-14
Released:17 Sep 1993
Season:1
Episode:2
Runtime:46 min
Genre:Drama
 Mystery
 Sci-Fi
Director:Daniel Sackheim
Writer:Chris Carter (created by)
 Chris Carter
Actors:David Duchovny
 Gillian Anderson
 Jerry Hardin
 Michael Bryan French
Plot:Mulder and Scully investigate the mysterious case of a military test pilot who disappeared after experiencing strange psychotic behaviour.
Language:English
Country:USA
Awards:N/A
Poster:http://ia.media-imdb.com/images/M/MV...._V1_SX300.jpg
Metascore:N/A
imdbRating:8.3
imdbVotes:3385
imdbID:tt0751099
seriesID:tt0106179
Type:episode
Response:True

and this is what I need to make it look like so that I can use FFmpeg to apply it to the mp4 file
Code:
;FFMETADATA1
major_brand=qt  
minor_version=512
compatible_brands=qt  
title=This Guilty Blood
album=Shadowhunters, Season 2
genre=Action
track=1/10
disc=2
date=2017-01-02
synopsis=Only hours have passed since Jace left with Valentine and all hell has broken loose at The Institute. Alec, Isabelle and Clary are desperate to find Jace, but are quickly stopped in their tracks with the arrival of Victor Aldertree, who means business about getting the Institute back on track. But getting the New York Shadowhunters in-line with The Clave may be counterintuitive to Alec, Isabelle and Clary's plan to rescue Jace. Meanwhile, Jocelyn has a lot to catch up on now that she is awake.
iTunEXTC=us-tv|TV-14|500
iTunMOVI=<?xml version\="1.0" encoding\="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version\="1.0"><dict>\
<key>cast</key><array>\
<dict><key>name</key><string>Katherine McNamara</string></dict>\
<dict><key>name</key><string>Dominic Sherwood</string></dict>\
<dict><key>name</key><string>Matthew Daddario</string></dict>\
<dict><key>name</key><string>Alberto Rosende</string></dict>\
<dict><key>name</key><string>Isaiah Mustafa</string></dict>\
</array>\
<key>screenwriters</key><array>\
<dict><key>name</key><string>Michael Reisz</string></dict>\
</array>\
<key>directors</key><array>\
<dict><key>name</key><string>Matt Hastings</string></dict>\
</array>\
</dict></plist>\

media_type=10
show=Shadowhunters
episode_id=This Guilty Blood
season_number=2
episode_sort=1
network=Freeform
hd_video=0
description=Only hours have passed since Jace left with Valentine and all hell has broken loose at The Institute.
encoder=Lavf57.25.100


Last edited by Simplify; 01-05-2017 at 09:35 AM..
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies

2. Shell Programming and Scripting

Refining if loops using sed/awk

hi All, I have the following two requirements: case 1: In a file i have the below code: if ((a>b)) a=b; else a = c; by using some means i need to convert the line to the following output: Output required: case 2: In a file i have the below code: if (a>b) a=b; else a... (4 Replies)
Discussion started by: engineer
4 Replies

3. Shell Programming and Scripting

SOLVED: Refining an awk command

I have a file (file1) with in the below format ST*820*212121 BPR*C*213212.20*C*212*CCD*01***01*071000013*DA*321321*101208 TRN*1*21321321*13213 N1*PR*3232. dff. SYS.*91*3232 ENT*1 N1*PE* 2132121321 RMR*TN*234456677888**192387.20*192387.20 REF*IV*234456677888*213213 3213 UNI... (0 Replies)
Discussion started by: Muthuraj K
0 Replies

4. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

5. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

6. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA_publish.sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies

7. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
All times are GMT -4. The time now is 08:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy