File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,11 @@ function processFile(file_contents) {
128128 let row_object = { } ;
129129
130130 rows . forEach ( function ( row , index ) {
131+ if ( row . startsWith ( '#' ) ) {
132+ processMetadata ( row ) ;
133+ return ;
134+ }
135+
131136 element_row_index ++
132137
133138 switch ( element_row_index ) {
@@ -169,7 +174,7 @@ function processFile(file_contents) {
169174 seekToStart ( ) ;
170175}
171176
172- $ ( '#video-url' ) . change ( function ( ) {
177+ $ ( '#video-url' ) . change ( function ( ) {
173178 let $this = $ ( this ) ;
174179
175180 clearInterval ( interval_id ) ;
@@ -306,4 +311,20 @@ $(document).ready(function () {
306311
307312 const inputElement = document . getElementById ( "chords-file" ) ;
308313 inputElement . addEventListener ( "change" , handleFile , false ) ;
309- } ) ;
314+ } ) ;
315+
316+ function processMetadata ( row ) {
317+ const content = row . slice ( 1 ) ;
318+ const separatorIndex = content . indexOf ( ":" ) ;
319+
320+ if ( separatorIndex === - 1 ) {
321+ return ;
322+ }
323+
324+ const key = content . slice ( 0 , separatorIndex ) . trim ( ) ;
325+ const value = content . slice ( separatorIndex + 1 ) . trim ( ) ;
326+
327+ if ( key === 'URL' ) {
328+ $ ( '#video-url' ) . val ( value ) . change ( ) ;
329+ }
330+ }
You can’t perform that action at this time.
0 commit comments