
    Mgh                     |    S SK r S SKrS SKrS SKrS SKJr  \ R                  R                  \5      r	\	S-   r	S r
S rg)    N)Forez	/../data/c           
         UR                  SS5      R                  SS5      n[        R                  R                  [        S-   5      nU(       do  [
        R                  " [        S-   [        S-   5        [        [        R                  S-   5        [        [        R                  S-   [        R                  -   5        g [        U5      nUc  g SR                  " U6 n[        R                  " U5      n[        R                   " UR"                  5      nUS	   nUS
   U l        [        SR                  [        R&                  [        R                  [)        U5      R+                  5       [)        U5      S95        g )Nztime  zin key_timein.jsonzsamplekey_timein.json`Generate api key here: https://developers.google.com/maps/documentation/geocoding/start?hl=en_US,and add it to jarviscli/data/key_timein.jsonzihttp://api.timezonedb.com/v2/get-time-zone?key=BFA6XBCZ8AL5&format=json&by=position&lat={:.6f}&lng={:.6f}	formatteddstzA{COLOR}The current date and time in {LOC} is: {TIME}{COLOR_RESET})COLORCOLOR_RESETLOCTIME)replaceospathisfilemodule_pathshutilcopy2printr   REDRESETgetLocationformatrequestsgetjsonloadstextr
   MAGENTAstrtitle)selfsexistslocsend_urlrjtimes           =/Users/admin/workspace/ai/Jarvis/jarviscli/packages/timeIn.pymainr,      s?   			'2&&ub1AWW^^K*;;<F%& 	!
 	HHpq	r 	HH<=jj	 	 a.C
{	--3V	458	: 
 	XA

166A[>DxDH	
M6$**!flln3t9  67    c                    [         S-   n[        U5       n[        R                  " U5      nS S S 5        SW;  d	  US   S:X  af  [	        [
        R                  S-   5        [	        [
        R                  S-   5        [	        [
        R                  S-   [
        R                  -   5        g US   nSR                  X5      n[        R                  " U5      n[        R                  " UR                  5      n US   S	   S
   S   S   nUS   S	   S
   S   S   n	X4$ ! , (       d  f       N= f! [         a     Of = f[        UR                  5      e)Nr   timeininsertyourkeyherezAPI key not addedr   r   zEhttps://maps.googleapis.com/maps/api/geocode/json?address={0}&key={1}resultsr   geometrylocationlatlng)r   openr   loadr   r   r   r   r   r   r   r   r   
IndexError	Exception)
r$   	file_path	json_filedatakeyr'   r(   r)   r4   r5   s
             r+   r   r   6   sA   //I	iIyy# 
ttH~1DDdhh,,-HHpq	r 	HH<=jj	 
x.COVVWX^  	XA

166A	l1oj)*5e<	l1oj)*5e<x/ 
0   AFF
s   D6$D, 
D),
D98D9)r   r   r   r   coloramar   r   dirname__file__r   r,   r    r-   r+   <module>rB      s=    	     ggooh'K'%7Pr-   