rllc / llc-archives

Archived sermons, backed by the cloud
https://llc-archives.herokuapp.com
MIT License
1 stars 1 forks source link

Create a RemoteMp3DiscoveryService #9

Closed smcadams86 closed 9 years ago

smcadams86 commented 9 years ago

RemoteMp3DiscoveryService

Create a RemoteMp3DiscoveryService strategy implementation that uses the amazon s3 java API to iterate all existing files uploaded. Download only the ID3 tag of each file and extract Mp3 data from each file.

architecture

asdfdas 1

benefits

Mp3 meta data synchronization as a service. Congregations would not need to run the spreadsheet-updater locally on their webcast computer. Synchronizing of MP3 data would happen via a quartz/cron job.

ugly example

        InputStream is = new URL(sermon).openStream()
        def size = 1024
        byte[] buf = new byte[size];
        is.read(buf, 0, size);

        File targetFile = File.createTempFile("temp", ".mp3");
        OutputStream outStream = new FileOutputStream(targetFile);
        outStream.write(buf);

        def mp3file = new Mp3File(targetFile.absolutePath);
        def id3v1Tag = mp3file.hasId3v1Tag() ? mp3file.id3v1Tag : mp3file.id3v2Tag
        def sermon = mp3DiscoveryService.extractId3v1TagData(targetFile, id3v1Tag)

        sermon.minister == 'John Doe'
        sermon.bibletext == '1 Kings 19:9-18'
        sermon.date == '04/12/2015'
        sermon.time == '18:30'
        sermon.notes == ''