8 """Read the current file whit some tech details according to format
11 dir_file (str): s3 path where file is storage
12 type_format (str): format name of current file
13 file_features (dict): features required to load file
14 session (boto3 obj): AWS client connection
15 rel_col (str): indicates release_id column name
19 dir_file = kwargs.get(
'dir_file')
20 type_format = kwargs.get(
'type_format')
21 file_features = kwargs.get(
'file_features')
22 session = kwargs.get(
'session')
23 rel_col = kwargs.get(
'release_col')
25 if type_format ==
"amz_sales" or type_format ==
"amz_sales2":
27 if type_format ==
"audiomack":
29 elif type_format ==
"audiosalad":
31 elif type_format ==
"deezer":
33 elif type_format ==
"facebook_revshare":
35 elif type_format ==
"FUGA":
37 elif type_format ==
"itunes":
39 elif type_format ==
"itunes_music" or type_format ==
"djmix":
40 return itunesTemplate().preprocessing_music(dir_file, file_features, session, rel_col)
41 elif type_format ==
"mixcloud":
43 elif "playground_" in type_format:
45 elif "secretly_canadian" in type_format:
47 elif "soundtrack_your_brand" in type_format:
49 elif "spotify_discovery" in type_format:
51 elif "tencent" in type_format:
53 elif "youtube_merlin" in type_format:
59 """Assign a custom column according to format
62 df (pandas dataframe): current file loaded as dataframe
63 type_format (str): format name of current file
64 filename (dict): current filename
68 type_format = kwargs.get(
'type_format')
69 filename = kwargs.get(
'filename')
70 if "amz_streams" in type_format:
72 elif type_format ==
"amz_sales2":
74 elif type_format ==
"audiosalad":
76 elif type_format ==
"FUGA":
78 elif type_format ==
"itunes":
80 elif type_format ==
"playground_digital_2":
82 elif "secretly_canadian" in type_format:
84 elif type_format ==
"spotify_trends":
85 SpotifyTemplate.territoryTrends(df, filename)
86 elif type_format ==
"state51":
88 elif type_format ==
"qobuz":
91 raise TemplateError(
"TYPE TEMPLATE NOT FOUND FOR {}.".format(filename))