Afrostream / afrostream-back-end

Simple backo for afrostream
1 stars 0 forks source link

import: Legeep S1E21 -> Legeep S1E26 #344

Closed syndr0m closed 7 years ago

syndr0m commented 7 years ago
// to import new contents from PF, duplicate this script & increment manualImportId
var manualImportId = "03";

// import script
var liste = JSON.parse(document.querySelector('pre').innerHTML).filter(function (o) {
  return o.filename.indexOf('LEGEEEP_S01EP21') !== -1 ||
             o.filename.indexOf('LEGEEEP_S01EP22') !== -1 ||
             o.filename.indexOf('LEGEEEP_S01EP23') !== -1 ||
             o.filename.indexOf('LEGEEEP_S01EP24') !== -1 ||
             o.filename.indexOf('LEGEEEP_S01EP25') !== -1 ||
             o.filename.indexOf('LEGEEEP_S01EP26') !== -1;
});
liste.sort(function(a, b) {
   if (a.filename === b.filename) return 0;
   return (a.filename < b.filename) ? -1 : 1;
});
function pad(n, width, z) {
  z = z || '0';
  n = n + '';
  return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
}
liste.map(function (o,i) { 
  var d = o.duration.split(':'); 
  var duration = parseInt(d[2], 10) + parseInt(d[1], 10)*60 + parseInt(d[0], 0) * 3600; 
  var name = o.filename.split('/').pop().replace('.mp4', '').replace('.mxf', '');
  var encodingId = o.uuid;
  var pfMd5Hash = o.md5Hash;
  var id = "01234567-89ab-cdef-"+manualImportId+"00-000000000"+pad(i, 3);
  var assetId1 = "01234567-89ab-cdef-"+manualImportId+"01-000000000"+pad(i, 3);
  var assetId2 = "01234567-89ab-cdef-"+manualImportId+"02-000000000"+pad(i, 3);
  var assetId3 = "01234567-89ab-cdef-"+manualImportId+"03-000000000"+pad(i, 3);

  return 'INSERT INTO "Videos" ' +
         '("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")' +
         'VALUES ' +
         "('"+id+"','"+name+"', true, null, '"+encodingId+"', false, '"+duration+"', '"+pfMd5Hash+"');"+
         'INSERT INTO "Assets" (_id, src, type, "videoId") ' + "VALUES ('"+assetId1+"', '"+ 'https://hw.cdn.afrostream.net/vod/'+name+'/'+encodingId+'.ism/master.m3u8' + "', 'application/vnd.apple.mpegurl', '"+id+"');"+
         'INSERT INTO "Assets" (_id, src, type, "videoId") ' + "VALUES ('"+assetId2+"', '"+ 'https://hw.cdn.afrostream.net/vod/'+name+'/'+encodingId+'.ism/'+encodingId+'.mpd' + "', 'application/dash+xml', '"+id+"');"+
         'INSERT INTO "Assets" (_id, src, type, "videoId") ' + "VALUES ('"+assetId3+"', '"+ 'http://hw.cdn.afrostream.net/vod/'+name+'/'+encodingId+'.ism/MANIFEST' + "', 'application/vnd.ms-sstr+xml', '"+id+"');";
}).join("\n") 
syndr0m commented 7 years ago
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0300-000000000000','LEGEEEP_S01EP21', true, null, '01610af5-e4e5-4d1f-973f-b95fbb76f03d', false, '1496', '0e7b5689634be52aa6ee794bb6f7a638');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0301-000000000000', 'https://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP21/01610af5-e4e5-4d1f-973f-b95fbb76f03d.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0300-000000000000');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0302-000000000000', 'https://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP21/01610af5-e4e5-4d1f-973f-b95fbb76f03d.ism/01610af5-e4e5-4d1f-973f-b95fbb76f03d.mpd', 'application/dash+xml', '01234567-89ab-cdef-0300-000000000000');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0303-000000000000', 'http://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP21/01610af5-e4e5-4d1f-973f-b95fbb76f03d.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0300-000000000000');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0300-000000000001','LEGEEEP_S01EP22', true, null, 'cac97e9f-50f8-4cfb-a8b3-45ba210e7802', false, '1489', 'c76d3e7dddfe6a181edc3ca6648de3ec');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0301-000000000001', 'https://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP22/cac97e9f-50f8-4cfb-a8b3-45ba210e7802.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0300-000000000001');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0302-000000000001', 'https://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP22/cac97e9f-50f8-4cfb-a8b3-45ba210e7802.ism/cac97e9f-50f8-4cfb-a8b3-45ba210e7802.mpd', 'application/dash+xml', '01234567-89ab-cdef-0300-000000000001');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0303-000000000001', 'http://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP22/cac97e9f-50f8-4cfb-a8b3-45ba210e7802.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0300-000000000001');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0300-000000000002','LEGEEEP_S01EP23', true, null, 'f9584f8b-b137-4c4f-8530-1069278a1beb', false, '1476', '51b763d497c1192e6b65c31dd9fb29a6');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0301-000000000002', 'https://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP23/f9584f8b-b137-4c4f-8530-1069278a1beb.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0300-000000000002');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0302-000000000002', 'https://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP23/f9584f8b-b137-4c4f-8530-1069278a1beb.ism/f9584f8b-b137-4c4f-8530-1069278a1beb.mpd', 'application/dash+xml', '01234567-89ab-cdef-0300-000000000002');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0303-000000000002', 'http://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP23/f9584f8b-b137-4c4f-8530-1069278a1beb.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0300-000000000002');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0300-000000000003','LEGEEEP_S01EP24', true, null, '336bdab9-96cd-47c8-815f-72fd04e59332', false, '1500', '4519cd8bb3f6720e9c04f26ebc86a53f');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0301-000000000003', 'https://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP24/336bdab9-96cd-47c8-815f-72fd04e59332.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0300-000000000003');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0302-000000000003', 'https://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP24/336bdab9-96cd-47c8-815f-72fd04e59332.ism/336bdab9-96cd-47c8-815f-72fd04e59332.mpd', 'application/dash+xml', '01234567-89ab-cdef-0300-000000000003');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0303-000000000003', 'http://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP24/336bdab9-96cd-47c8-815f-72fd04e59332.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0300-000000000003');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0300-000000000004','LEGEEEP_S01EP25', true, null, '05214544-6e14-4271-b459-1d40db2b307d', false, '1508', 'ce95ac0f8a1dc95a33cae8d33117839f');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0301-000000000004', 'https://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP25/05214544-6e14-4271-b459-1d40db2b307d.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0300-000000000004');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0302-000000000004', 'https://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP25/05214544-6e14-4271-b459-1d40db2b307d.ism/05214544-6e14-4271-b459-1d40db2b307d.mpd', 'application/dash+xml', '01234567-89ab-cdef-0300-000000000004');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0303-000000000004', 'http://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP25/05214544-6e14-4271-b459-1d40db2b307d.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0300-000000000004');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0300-000000000005','LEGEEEP_S01EP26', true, null, '461119b6-e4ed-46f2-91e4-3e152dc7f6bf', false, '1495', '5c328ae3f3ee36354b8ab3482c98633e');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0301-000000000005', 'https://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP26/461119b6-e4ed-46f2-91e4-3e152dc7f6bf.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0300-000000000005');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0302-000000000005', 'https://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP26/461119b6-e4ed-46f2-91e4-3e152dc7f6bf.ism/461119b6-e4ed-46f2-91e4-3e152dc7f6bf.mpd', 'application/dash+xml', '01234567-89ab-cdef-0300-000000000005');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0303-000000000005', 'http://hw.cdn.afrostream.net/vod/LEGEEEP_S01EP26/461119b6-e4ed-46f2-91e4-3e152dc7f6bf.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0300-000000000005');
syndr0m commented 7 years ago

done