Skip to content

Instantly share code, notes, and snippets.

@mcotton
Last active August 29, 2018 18:28
Show Gist options
  • Save mcotton/d16fd3867515924d5e5cb661282a7ea6 to your computer and use it in GitHub Desktop.
Save mcotton/d16fd3867515924d5e5cb661282a7ea6 to your computer and use it in GitHub Desktop.
Moving Media/Checklists from H1 -> H2
def export_dict(self):
return {
"H1_id": self.key.id(),
"gcs_filename": self.gcs_filename,
"serving_url": self.serving_url,
"file_name": self.file_name,
"created_at": str(self.created_at),
"company": self.company.id(),
"project": self.project.id(),
"mime_type": self.mime_type,
"description": self.description,
"client_visible": self.client_visible,
"file_size": self.file_size,
"published_to_client": self.published_to_client,
"vimeo_status": self.vimeo_status,
"vimeo_ticket": self.vimeo_ticket,
"vimeo_clip": self.vimeo_clip,
"vimeo_clip_snapshot": self.vimeo_clip_snapshot
}
Media.export_dict = export_dict
for item in media_for_t1:
with open('exports/media/' + str(item.key.id()) + '.json', 'w') as f:
json.dump(item.export_dict(), f)
import dateutil.parser
for js in os.listdir('/Users/cotton/dev/huvr/huvr_old/huvr/exports/media'):
if '.json' in js:
print js
with open(os.path.join('/Users/cotton/dev/huvr/huvr_old/huvr/exports/media', js)) as json_file:
i = json.load(json_file)
i['company'] = deshaw.key
i['project'] = t1.key
i['created_at'] = dateutil.parser.parse(i['created_at'])
new_i = Media(**i)
new_i.put()
print '%s -> %s' % (new_i.H1_id, new_i.key.id())
In [16]: for m in media_for_t1:
print '%s -> %s' % (m.H1_id, m.key.id())
5638319023063040 -> 4767349114667008
5707614964940800 -> 4786738610307072
6286170816249856 -> 4788462637023232
4841494947037184 -> 4791762967068672
4686971150532608 -> 4798492509732864
5181635955785728 -> 4801217398046720
4885990405570560 -> 4803642913718272
4803522872737792 -> 4820885613576192
5120989138518016 -> 4829585791254528
4863190034808832 -> 4849340090679296
5764816950001664 -> 4869305648807936
5835711156584448 -> 4881639519813632
6329078613278720 -> 4899504771825664
6488054411821056 -> 4901732333125632
4904512586252288 -> 4908086603022336
4815076770971648 -> 4921159946600448
5794830584119296 -> 5066973331324928
5806660803100672 -> 5067350147596288
5248914370330624 -> 5068213587017728
5131134925012992 -> 5069937613733888
5033660910665728 -> 5071063482368000
5424986386857984 -> 5073237943779328
4675002586628096 -> 5078918121914368
5762418747637760 -> 5079967486443520
5648939135008768 -> 5082692374757376
5947398291456000 -> 5085117890428928
6076305560829952 -> 5096446688755712
6496698570375168 -> 5098132597637120
6136679278575616 -> 5100541537419264
5730415335702528 -> 5100852838662144
5404337257840640 -> 5102360590286848
5979272585936896 -> 5103591014531072
4670812946694144 -> 5104841068118016
6328441347506176 -> 5106463810781184
5101302887481344 -> 5111060767965184
4680760896258048 -> 5112042520313856
5069040166895616 -> 5115764965113856
4885661169483776 -> 5121052824829952
5927327775064064 -> 5129672555757568
5631990120316928 -> 5130815067389952
5932786175180800 -> 5136337808130048
5465311700582400 -> 5139895836213248
6011890312413184 -> 5140859787935744
5593440641351680 -> 5143942450380800
4821498384613376 -> 5144969937420288
5153571834167296 -> 5148319475040256
5967287211261952 -> 5150780625518592
4533601794260992 -> 5163114496524288
6076012865519616 -> 5167201493450752
6273814597992448 -> 5169392413310976
6310740981972992 -> 5175602264932352
6261408584957952 -> 5180979748536320
5416983654825984 -> 5183207309836288
5778372269441024 -> 5189561579732992
4913551881797632 -> 5196781688193024
5201505548238848 -> 5202337681375232
4829790355849216 -> 5202634923311104
6357487842230272 -> 5203760791945216
5723220862828544 -> 5412290044100608
5938254473854976 -> 5471036556443648
5111265332559872 -> 5629923284746240
5717797661310976 -> 5630300101017600
6230862106460160 -> 5631163540439040
5369836221759488 -> 5632887567155200
5662387919126528 -> 5633624338595840
6722062483718144 -> 5634013435789312
4667111221755904 -> 5636187897200640
6212816398712832 -> 5641868075335680
4815740074983424 -> 5642917439864832
6441035794219008 -> 5645642328178688
6667101028745216 -> 5648067843850240
6007625544105984 -> 5659396642177024
5164389111955456 -> 5661082551058432
5441745886117888 -> 5663491490840576
4881725637263360 -> 5663802792083456
5362154504978432 -> 5665310543708160
4895299076096000 -> 5666540967952384
5596162576875520 -> 5667791021539328
4668930677276672 -> 5669413764202496
6194940073738240 -> 5674010721386496
5727602702548992 -> 5674992473735168
5759174839369728 -> 5678714918535168
6025668567498752 -> 5678971274395648
5030620073820160 -> 5684002778251264
5647643128627200 -> 5692622509178880
5237952540049408 -> 5693765020811264
4534899679690752 -> 5699287761551360
5063716554932224 -> 5702845789634560
6455524228857856 -> 5703809741357056
6327405455081472 -> 5705436191784960
4882914135244800 -> 5706892403802112
5120245438087168 -> 5707919890841600
6374814277173248 -> 5711269428461568
5530389347041280 -> 5713730578939904
4793894092931072 -> 5714712331288576
5184841075130368 -> 5726064449945600
6322124792791040 -> 5726555032518656
6214261151891456 -> 5730151446872064
4751857268293632 -> 5732342366732288
6289100520816640 -> 5738552218353664
5160270909407232 -> 5743929701957632
6437865571483648 -> 5746157263257600
5170030148845568 -> 5752511533154304
4806886268338176 -> 5759731641614336
5191273459744768 -> 5765287634796544
5084997849448448 -> 5765584876732416
6359662806958080 -> 5766710745366528
4897474074378240 -> 5768969847832576
5196224885948416 -> 5912638517149696
6655833450479616 -> 5924392416575488
6248869830590464 -> 5927117304889344
5118389341126656 -> 5946785520418816
6437994957373440 -> 5975239997521920
5716521787588608 -> 6025404678668288
5660799586533376 -> 6033986509864960
5766128659857408 -> 6193250054438912
6732625049812992 -> 6194113493860352
5136652213157888 -> 6195837520576512
5311965664641024 -> 6199137850621952
5162895939731456 -> 6204818028756992
4766674368593920 -> 6205867393286144
4805441515159552 -> 6208592281600000
5647947802869760 -> 6211017797271552
5877757175136256 -> 6224032504479744
5739724006227968 -> 6226441444261888
5444675590684672 -> 6228260497129472
5384448338034688 -> 6230740974960640
6223631126364160 -> 6236960674807808
4900160979075072 -> 6237942427156480
5201032699183104 -> 6246952731672576
5574694082183168 -> 6255572462600192
5992339621281792 -> 6256714974232576
5379206196232192 -> 6262237714972672
5994585486524416 -> 6265795743055872
4807848710111232 -> 6270869844262912
5145739692867584 -> 6276680532361216
6156390594772992 -> 6289014403366912
5202541440663552 -> 6301502171774976
6307143544209408 -> 6306879655378944
6471091438485504 -> 6309107216678912
4909798483034112 -> 6315461486575616
5231880630697984 -> 6328534830153728
6733922935242752 -> 6329660698787840
5185987562962944 -> 6596936463286272
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment