@@ -107,72 +107,39 @@ def get_reviewed_date() -> str:
107
107
108
108
return f"[[{ year } -{ month } -{ day } ]]"
109
109
110
+ #==============================================================================#
111
+ # MAIN FUNCTION
112
+ #==============================================================================#
113
+
114
+
110
115
def main ():
111
116
input_type = get_input_type ()
112
- match input_type :
117
+ match input_type [ 0 ] :
113
118
case None | "q" :
114
119
print ("Exiting..." )
115
120
exit ()
116
121
case "Video" :
117
- pass # TODO HERE
118
- if input_type [0 ] == "Video" :
119
- def youtube (input_type ):
120
122
file_name = get_file_name (input_type [1 ])
121
123
file_tags = get_tags ()
122
124
url = get_input_url (input_type [0 ])
123
125
youtube_shortcode = url [1 ]
124
126
host = get_channel_host ()
125
127
publish_date = get_publish_date ()
126
128
reviewed_date = get_reviewed_date ()
127
- template_video = f"""---
128
- tags: 📥️/🎥️/🟥️
129
- publish: true
130
- aliases:
131
- -
132
- cssclass:
133
- type: { input_type [0 ]}
134
- status: 🟥️
135
- ---
136
-
137
- - `Title:` [[{ file_name } ]]
138
- - `Type:` [[{ input_type [1 ]} ]]
139
- - `Tags:` { file_tags }
140
- - `URL:` <{ url [0 ]} >
141
- - `Channel/Host:` [[{ host } ]]
142
- - `Reference:`
143
- - `Publish Date:` { publish_date }
144
- - `Reviewed Date:` { reviewed_date }
145
-
146
- ---
147
-
148
- <center><iframe width="560" height="315" src="https://www.youtube.com/embed/{ youtube_shortcode } " frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></center>
149
-
150
- ---
151
-
152
- - <% tp.file.cursor(1) %>
153
-
154
- """
129
+ with open ('../templates/Youtube.md' , 'r' ) as f :
130
+ text = f .read ()
131
+ text = text .replace ('{file_name}' , file_name )
132
+ text = text .replace ('{file_tags}' , file_tags )
133
+ text = text .replace ('{url}' , url [0 ])
134
+ text = text .replace ('{youtube_shortcode}' , youtube_shortcode )
135
+ text = text .replace ('{host}' , host )
136
+ text = text .replace ('{publish_date}' , publish_date )
137
+ text = text .replace ('{reviewed_date}' , reviewed_date )
138
+ print (text )
155
139
with open (DROP_POINT_PATH + f"/{ file_name } .md" , "w" ) as file :
156
- file .write (f"{ template_video } " )
157
- youtube (input_type )
140
+ file .write (f"{ text } " )
158
141
# TODO add other input functions here
159
142
160
- # TODO add other templates here
161
- # ============================================================================= #
162
- # TEMPLATES
163
- # ============================================================================= #
164
-
165
143
166
144
if __name__ == "__main__" :
167
145
main ()
168
-
169
-
170
- # todo refactor code with the py3.10 match statements
171
- # refactor
172
- # quit = False
173
- # match quit:
174
- # case True:
175
- # print("Quitting")
176
- # exit()
177
- # case False:
178
- # print("System is on")
0 commit comments