def main():
    [city_name, latitude, longitude, tz] = sys.argv[1:5]
    year = int(sys.argv[5])

    computeLagnams = False  # Default
    script = sanscript.DEVANAGARI  # Default script is devanagari

    if len(sys.argv) == 8:
        computeLagnams = True
        script = sys.argv[6]
    elif len(sys.argv) == 7:
        script = sys.argv[6]
        computeLagnams = False

    city = City(city_name, latitude, longitude, tz)

    panchangam = scripts.get_panchangam(city=city,
                                        year=year,
                                        script=script,
                                        computeLagnams=computeLagnams)

    panchangam.add_details()

    daily_template_file = open(
        os.path.join(CODE_ROOT,
                     'panchangam/data/templates/daily_cal_template.tex'))
    writeDailyTeX(panchangam, daily_template_file, computeLagnams)
Esempio n. 2
0
  def get(self, lattitude, longitude, year):
    args = self.get_parser.parse_args()
    city = City("", lattitude, longitude, args['timezone'])
    panchangam = scripts.get_panchangam(city=city, year=int(year), script=args['encoding'])

    panchangam.compute_festivals()
    panchangam.assign_relative_festivals()
    panchangam.compute_solar_eclipses()
    panchangam.compute_lunar_eclipses()
    panchangam.computeTransits()
    return panchangam.to_json_map()
Esempio n. 3
0
def main():
    [city_name, latitude, longitude, tz] = sys.argv[1:5]
    year = int(sys.argv[5])

    if len(sys.argv) == 7:
        script = sys.argv[6]
    else:
        script = sanscript.IAST  # Default script is IAST for writing calendar

    city = City(city_name, latitude, longitude, tz)

    panchangam = scripts.get_panchangam(city=city, year=year, script=script)
    panchangam.add_details()

    ics_calendar = compute_calendar(panchangam)
    write_to_file(ics_calendar, '%s-%d-%s.ics' % (city_name, year, script))
def main():
    [json_file, city_name, latitude, longitude, tz] = sys.argv[1:6]
    if not os.path.isfile(json_file):
        raise IOError('File %s not found!' % json_file)

    year = int(sys.argv[6])

    if len(sys.argv) == 8:
        script = sys.argv[7]
    else:
        script = 'iast'  # Default script is IAST for writing calendar

    city = City(city_name, latitude, longitude, tz)

    panchangam = scripts.get_panchangam(city=city, year=year, script=script)
    # panchangam.add_details()

    compute_events(panchangam, json_file)
    cal_file_name = '%s-%s-%s' % (city_name, year, os.path.basename(json_file).replace('.json', '.ics'))
    computeIcsCalendar(panchangam, cal_file_name)
    print('Wrote ICS file to %s' % cal_file_name)
def main():
    [city_name, latitude, longitude, tz] = sys.argv[1:5]
    year = int(sys.argv[5])

    script = sanscript.DEVANAGARI  # Default script is devanagari

    if len(sys.argv) == 7:
        script = sys.argv[6]

    logging.debug(script)

    city = City(city_name, latitude, longitude, tz)
    panchangam = scripts.get_panchangam(city=city, year=year, script=script)

    panchangam.compute_festivals()
    panchangam.assign_relative_festivals()
    panchangam.compute_solar_eclipses()
    panchangam.compute_lunar_eclipses()
    panchangam.computeTransits()

    monthly_template_file = open(os.path.join(CODE_ROOT, 'panchangam/data/templates/monthly_cal_template.tex'))
    writeMonthlyTeX(panchangam, monthly_template_file)