Afrostream / afrostream-back-end

Simple backo for afrostream
1 stars 0 forks source link

import: Sexless_S02E01-E9 #364

Closed syndr0m closed 8 years ago

syndr0m commented 8 years ago

spebsd: contentId>=12492 && contentId <= 12500


added a JavaScript/JSON snippet 
+-----------+------+---------------------------------------------------------------------+
| contentId | lang | url                                                                 |
+-----------+------+---------------------------------------------------------------------+
|     12492 | eng  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E01_en.vtt |
|     12492 | fra  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E01_fr.vtt |
|     12493 | eng  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E02_en.vtt |
|     12493 | fra  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E02_fr.vtt |
|     12494 | eng  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E03_en.vtt |
|     12494 | fra  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E03_fr.vtt |
|     12495 | eng  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E04_en.vtt |
|     12495 | fra  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E04_fr.vtt |
|     12496 | eng  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E05_en.vtt |
|     12496 | fra  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E05_fr.vtt |
|     12497 | eng  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E06_en.vtt |
|     12497 | fra  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E06_fr.vtt |
|     12498 | eng  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E07_en.vtt |
|     12498 | fra  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E07_fr.vtt |
|     12499 | eng  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E08_en.vtt |
|     12499 | fra  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E08_fr.vtt |
|     12500 | eng  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E09_en.vtt |
|     12500 | fra  | http://sources-1.adm.afrostream.net/subtitles/Sexless_S02E09_fr.vtt |
+-----------+------+---------------------------------------------------------------------+
// to import new contents from PF, duplicate this script & increment manualImportId
var manualImportId = "09";

// import script
var liste = JSON.parse(document.querySelector('pre').innerHTML).filter(function (o) {
  return  o.contentId>=12492 && o.contentId <= 12500;
});
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('.mov', '').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 8 years ago
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0900-000000000000','Sexless_S02E01', true, null, 'e06842be-fc6e-4343-888c-585d2c74dbdd', false, '1778', '96bdfc93625f6d90ac7839bdc0971f1f');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0901-000000000000', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E01/e06842be-fc6e-4343-888c-585d2c74dbdd.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0900-000000000000');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0902-000000000000', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E01/e06842be-fc6e-4343-888c-585d2c74dbdd.ism/e06842be-fc6e-4343-888c-585d2c74dbdd.mpd', 'application/dash+xml', '01234567-89ab-cdef-0900-000000000000');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0903-000000000000', 'http://hw.cdn.afrostream.net/vod/Sexless_S02E01/e06842be-fc6e-4343-888c-585d2c74dbdd.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0900-000000000000');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0900-000000000001','Sexless_S02E02', true, null, '7dd1475c-9835-46e5-919f-e43ef5f78afd', false, '1735', '188022d9f62f7ddcfe5d08371a34ec6c');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0901-000000000001', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E02/7dd1475c-9835-46e5-919f-e43ef5f78afd.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0900-000000000001');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0902-000000000001', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E02/7dd1475c-9835-46e5-919f-e43ef5f78afd.ism/7dd1475c-9835-46e5-919f-e43ef5f78afd.mpd', 'application/dash+xml', '01234567-89ab-cdef-0900-000000000001');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0903-000000000001', 'http://hw.cdn.afrostream.net/vod/Sexless_S02E02/7dd1475c-9835-46e5-919f-e43ef5f78afd.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0900-000000000001');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0900-000000000002','Sexless_S02E03', true, null, 'b3db6c8b-e9f4-43ac-bbd5-0c26425c4020', false, '1857', '52421fb2ae1e88f46385509c76079f4c');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0901-000000000002', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E03/b3db6c8b-e9f4-43ac-bbd5-0c26425c4020.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0900-000000000002');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0902-000000000002', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E03/b3db6c8b-e9f4-43ac-bbd5-0c26425c4020.ism/b3db6c8b-e9f4-43ac-bbd5-0c26425c4020.mpd', 'application/dash+xml', '01234567-89ab-cdef-0900-000000000002');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0903-000000000002', 'http://hw.cdn.afrostream.net/vod/Sexless_S02E03/b3db6c8b-e9f4-43ac-bbd5-0c26425c4020.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0900-000000000002');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0900-000000000003','Sexless_S02E04', true, null, 'dd6c85ec-fde6-49c2-9340-fdca98875be0', false, '1937', 'ce8bc4de337b32eb7e51b87a92414e0a');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0901-000000000003', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E04/dd6c85ec-fde6-49c2-9340-fdca98875be0.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0900-000000000003');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0902-000000000003', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E04/dd6c85ec-fde6-49c2-9340-fdca98875be0.ism/dd6c85ec-fde6-49c2-9340-fdca98875be0.mpd', 'application/dash+xml', '01234567-89ab-cdef-0900-000000000003');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0903-000000000003', 'http://hw.cdn.afrostream.net/vod/Sexless_S02E04/dd6c85ec-fde6-49c2-9340-fdca98875be0.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0900-000000000003');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0900-000000000004','Sexless_S02E05', true, null, 'ab3a61f2-b662-4cba-aecd-e25181a00178', false, '2017', 'a6555f98dafebf13b3a4beea7a1a1220');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0901-000000000004', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E05/ab3a61f2-b662-4cba-aecd-e25181a00178.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0900-000000000004');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0902-000000000004', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E05/ab3a61f2-b662-4cba-aecd-e25181a00178.ism/ab3a61f2-b662-4cba-aecd-e25181a00178.mpd', 'application/dash+xml', '01234567-89ab-cdef-0900-000000000004');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0903-000000000004', 'http://hw.cdn.afrostream.net/vod/Sexless_S02E05/ab3a61f2-b662-4cba-aecd-e25181a00178.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0900-000000000004');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0900-000000000005','Sexless_S02E06', true, null, '8041a201-268d-418c-94f8-f34e117b9b2a', false, '1796', 'bf4aa714a38d65c634717203dce46fbc');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0901-000000000005', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E06/8041a201-268d-418c-94f8-f34e117b9b2a.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0900-000000000005');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0902-000000000005', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E06/8041a201-268d-418c-94f8-f34e117b9b2a.ism/8041a201-268d-418c-94f8-f34e117b9b2a.mpd', 'application/dash+xml', '01234567-89ab-cdef-0900-000000000005');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0903-000000000005', 'http://hw.cdn.afrostream.net/vod/Sexless_S02E06/8041a201-268d-418c-94f8-f34e117b9b2a.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0900-000000000005');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0900-000000000006','Sexless_S02E07', true, null, 'f8640218-39f9-4d8e-b411-7ce81fe7588b', false, '1711', 'b281479b2b1bf334b1b81e4ad6bb2d06');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0901-000000000006', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E07/f8640218-39f9-4d8e-b411-7ce81fe7588b.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0900-000000000006');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0902-000000000006', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E07/f8640218-39f9-4d8e-b411-7ce81fe7588b.ism/f8640218-39f9-4d8e-b411-7ce81fe7588b.mpd', 'application/dash+xml', '01234567-89ab-cdef-0900-000000000006');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0903-000000000006', 'http://hw.cdn.afrostream.net/vod/Sexless_S02E07/f8640218-39f9-4d8e-b411-7ce81fe7588b.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0900-000000000006');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0900-000000000007','Sexless_S02E08', true, null, '45ff477c-09e6-46ab-8072-a94f039f61d3', false, '1916', '491b3497f492c8685d37a1219da97bf8');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0901-000000000007', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E08/45ff477c-09e6-46ab-8072-a94f039f61d3.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0900-000000000007');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0902-000000000007', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E08/45ff477c-09e6-46ab-8072-a94f039f61d3.ism/45ff477c-09e6-46ab-8072-a94f039f61d3.mpd', 'application/dash+xml', '01234567-89ab-cdef-0900-000000000007');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0903-000000000007', 'http://hw.cdn.afrostream.net/vod/Sexless_S02E08/45ff477c-09e6-46ab-8072-a94f039f61d3.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0900-000000000007');
INSERT INTO "Videos" ("_id", "name", "active", "importId", "encodingId", "drm", "duration", "pfMd5Hash")VALUES ('01234567-89ab-cdef-0900-000000000008','Sexless_S02E09', true, null, '3977a692-a102-4a60-8118-09c80eb704be', false, '2466', '4024a4671e02f3f1b2eab60413615302');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0901-000000000008', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E09/3977a692-a102-4a60-8118-09c80eb704be.ism/master.m3u8', 'application/vnd.apple.mpegurl', '01234567-89ab-cdef-0900-000000000008');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0902-000000000008', 'https://hw.cdn.afrostream.net/vod/Sexless_S02E09/3977a692-a102-4a60-8118-09c80eb704be.ism/3977a692-a102-4a60-8118-09c80eb704be.mpd', 'application/dash+xml', '01234567-89ab-cdef-0900-000000000008');INSERT INTO "Assets" (_id, src, type, "videoId") VALUES ('01234567-89ab-cdef-0903-000000000008', 'http://hw.cdn.afrostream.net/vod/Sexless_S02E09/3977a692-a102-4a60-8118-09c80eb704be.ism/MANIFEST', 'application/vnd.ms-sstr+xml', '01234567-89ab-cdef-0900-000000000008');
syndr0m commented 8 years ago

(stand by, waiting for #365 fix pushed into production)

syndr0m commented 8 years ago

done