Lớp Python và CLI cho các tiện ích lịch khác nhau theo Lịch Hindu. Nó sử dụng drikPanchang. com để truy vấn dữ liệu
Một số tính năng
- Tìm Tithi của một ngày cụ thể
- Truy vấn Panchang hàng ngày
- Tìm sự xuất hiện của một Tithi cụ thể trong năm hiện tại [hoặc được chỉ định]
- Khả năng chỉ định ngày ở cả định dạng khu vực hoặc Gregorian
- Hiển thị bằng ngôn ngữ khu vực
- Trình tạo lịch ICS [Viết Janma-Tithi trên lịch Gregorian cho năm được chỉ định]
Các tập tin
lịch Hindu. py
Lớp Lịch Hindu cốt lõi
hcal_cli. py
Cung cấp giao diện dòng lệnh cho các tùy chọn truy vấn khác nhau bằng cách sử dụng lớp HinduCalendar
ics_creator. py
Chấp nhận tệp
.csv
chứa các sự kiện và tạo tệp.ics
biểu thị Tithi của ngày sinh nhật/ngày kỷ niệm trên tệp lịch Gregorian do đó được tạo có thể nhập được trong Lịch Google
Yêu cầu
web dev yêu cầu beautifulsoup4 bộ mã hóa địa lý ics
Cài đặt CLI
Tải các tập tin vào một thư mục của sự lựa chọn của bạn. Đặt tất cả các trường _______ 38 _______ cạnh nhau. Điều hướng đến thư mục
$ pip install requests beautifulsoup4 geocoder ics
$ chmod +x hcal_cli.py ics_creator.py
Liên kết nó với bất kỳ vị trí nào trong đường dẫn
$ ln -s hcal_cli.py ~/bin/hcal
$ hcal -h
usage: hcal [-h] [-d date] [-f] [-r] [-m M] [-c] [-y year] [-l] [-s]
Hindu Calendar Utilities
optional arguments:
-h, --help show this help message and exit
-d date Date in dd/mm/yyyy
-f Fresh configuration
-r Input regional date
-m M Regional method to use
-c Find re-occurrence of Tithi of the 'date' in the current year
-y year Use with '-c' to specify year
-l Display in regional language
-s Show config and exit
Ngoài ra, người ta có thể chạy tệp bằng cách sử dụng python3 hcal_cli.py
Sử dụng lớp
Sử dụng help[HinduCalendar]
trong bảng điều khiển python để xem trợ giúp chi tiết
>>> import datetime
>>> from hindu_calendar import HinduCalendar
>>> cal =HinduCalendar[method='marathi']
>>> cal.find_city['Mumbai']
>>> cal.set_city['1275339', 'Mumbai']
>>> today = datetime.datetime.today[].strftime["%d/%m/%Y"]
>>> cal.find_date[today]
>>> cal.find_occurrence['15/08/1947', year='2020']
Sử dụng CLI
$ ln -s hcal_cli.py ~/bin/hcal
$ hcal -h
0Lần chạy đầu tiên sẽ tương tác thiết lập cấu hình ban đầu. Các lần chạy tiếp theo sẽ hiển thị đối tượng ngày cho 'hôm nay'
$ ln -s hcal_cli.py ~/bin/hcal
$ hcal -h
1Trả về đối tượng ngày cho ngày đã cho Các định dạng được chấp nhận khác. [dd-mm-yyyy, dd. mm. yyyy, đ. mm. yyyy, dd, dd-mm]
$ ln -s hcal_cli.py ~/bin/hcal
$ hcal -h
2Chỉ định phương thức khu vực nào sẽ sử dụng để truy vấn và hiển thị đối tượng ngày
phương pháp có sẵn. Tiếng Marathi, Tiếng Hindi, Tiếng Bengal, Tiếng Tamil, Tiếng Telugu, Tiếng Kannada, Tiếng Gujarati, Tiếng Malayalam
$ ln -s hcal_cli.py ~/bin/hcal
$ hcal -h
3Cờ
$ ln -s hcal_cli.py ~/bin/hcal
$ hcal -h
4 cho biết rằng ngày được chỉ định ở định dạng khu vực. Mặc dù cách tự nhiên nhất để chỉ định ngày trong khu vực là theo tuần trăng, CLI dự kiến ngày sẽ được chỉ định ở định dạng $ ln -s hcal_cli.py ~/bin/hcal
$ hcal -h
5$ ln -s hcal_cli.py ~/bin/hcal
$ hcal -h
6 - Chỉ số ngày. Đối với một 'Ashtami' từ nửa sau của tháng, do đó, ngày sẽ không phải là $ ln -s hcal_cli.py ~/bin/hcal
$ hcal -h
7, mà là $ ln -s hcal_cli.py ~/bin/hcal
$ hcal -h
8 [15+8]. $ ln -s hcal_cli.py ~/bin/hcal
$ hcal -h
9 - Chỉ số tháng theo chỉ số khu vực. [e. g. usage: hcal [-h] [-d date] [-f] [-r] [-m M] [-c] [-y year] [-l] [-s]
Hindu Calendar Utilities
optional arguments:
-h, --help show this help message and exit
-d date Date in dd/mm/yyyy
-f Fresh configuration
-r Input regional date
-m M Regional method to use
-c Find re-occurrence of Tithi of the 'date' in the current year
-y year Use with '-c' to specify year
-l Display in regional language
-s Show config and exit
0 có chỉ số usage: hcal [-h] [-d date] [-f] [-r] [-m M] [-c] [-y year] [-l] [-s]
Hindu Calendar Utilities
optional arguments:
-h, --help show this help message and exit
-d date Date in dd/mm/yyyy
-f Fresh configuration
-r Input regional date
-m M Regional method to use
-c Find re-occurrence of Tithi of the 'date' in the current year
-y year Use with '-c' to specify year
-l Display in regional language
-s Show config and exit
1 trong lịch Bắc Ấn Độ [usage: hcal [-h] [-d date] [-f] [-r] [-m M] [-c] [-y year] [-l] [-s]
Hindu Calendar Utilities
optional arguments:
-h, --help show this help message and exit
-d date Date in dd/mm/yyyy
-f Fresh configuration
-r Input regional date
-m M Regional method to use
-c Find re-occurrence of Tithi of the 'date' in the current year
-y year Use with '-c' to specify year
-l Display in regional language
-s Show config and exit
2], trong khi cùng tháng sẽ có chỉ số usage: hcal [-h] [-d date] [-f] [-r] [-m M] [-c] [-y year] [-l] [-s]
Hindu Calendar Utilities
optional arguments:
-h, --help show this help message and exit
-d date Date in dd/mm/yyyy
-f Fresh configuration
-r Input regional date
-m M Regional method to use
-c Find re-occurrence of Tithi of the 'date' in the current year
-y year Use with '-c' to specify year
-l Display in regional language
-s Show config and exit
3 trong lịch Bangali [usage: hcal [-h] [-d date] [-f] [-r] [-m M] [-c] [-y year] [-l] [-s]
Hindu Calendar Utilities
optional arguments:
-h, --help show this help message and exit
-d date Date in dd/mm/yyyy
-f Fresh configuration
-r Input regional date
-m M Regional method to use
-c Find re-occurrence of Tithi of the 'date' in the current year
-y year Use with '-c' to specify year
-l Display in regional language
-s Show config and exit
4]. usage: hcal [-h] [-d date] [-f] [-r] [-m M] [-c] [-y year] [-l] [-s]
Hindu Calendar Utilities
optional arguments:
-h, --help show this help message and exit
-d date Date in dd/mm/yyyy
-f Fresh configuration
-r Input regional date
-m M Regional method to use
-c Find re-occurrence of Tithi of the 'date' in the current year
-y year Use with '-c' to specify year
-l Display in regional language
-s Show config and exit
5 - Năm trong lịch khu vựcusage: hcal [-h] [-d date] [-f] [-r] [-m M] [-c] [-y year] [-l] [-s]
Hindu Calendar Utilities
optional arguments:
-h, --help show this help message and exit
-d date Date in dd/mm/yyyy
-f Fresh configuration
-r Input regional date
-m M Regional method to use
-c Find re-occurrence of Tithi of the 'date' in the current year
-y year Use with '-c' to specify year
-l Display in regional language
-s Show config and exit
6 Tìm Tithi vào ngày $ ln -s hcal_cli.py ~/bin/hcal
$ hcal -h
5, sau đó trả về đối tượng ngày tương ứng với sự xuất hiện của Tithi đó trong năm hiện tại. [Có thể chỉ định năm bằng cờ usage: hcal [-h] [-d date] [-f] [-r] [-m M] [-c] [-y year] [-l] [-s]
Hindu Calendar Utilities
optional arguments:
-h, --help show this help message and exit
-d date Date in dd/mm/yyyy
-f Fresh configuration
-r Input regional date
-m M Regional method to use
-c Find re-occurrence of Tithi of the 'date' in the current year
-y year Use with '-c' to specify year
-l Display in regional language
-s Show config and exit
8, đi cùng với cờ usage: hcal [-h] [-d date] [-f] [-r] [-m M] [-c] [-y year] [-l] [-s]
Hindu Calendar Utilities
optional arguments:
-h, --help show this help message and exit
-d date Date in dd/mm/yyyy
-f Fresh configuration
-r Input regional date
-m M Regional method to use
-c Find re-occurrence of Tithi of the 'date' in the current year
-y year Use with '-c' to specify year
-l Display in regional language
-s Show config and exit
9]Sáng tạo ICS
Sau đây là một tệp
>>> import datetime
>>> from hindu_calendar import HinduCalendar
>>> cal =HinduCalendar[method='marathi']
>>> cal.find_city['Mumbai']
>>> cal.set_city['1275339', 'Mumbai']
>>> today = datetime.datetime.today[].strftime["%d/%m/%Y"]
>>> cal.find_date[today]
>>> cal.find_occurrence['15/08/1947', year='2020']
0 mẫudate,regional_date,label,name,method,use_regional,include
15-08-1947,,Independence Day,India,marathi,0,1
Cờ
>>> import datetime
>>> from hindu_calendar import HinduCalendar
>>> cal =HinduCalendar[method='marathi']
>>> cal.find_city['Mumbai']
>>> cal.set_city['1275339', 'Mumbai']
>>> today = datetime.datetime.today[].strftime["%d/%m/%Y"]
>>> cal.find_date[today]
>>> cal.find_occurrence['15/08/1947', year='2020']
1 là >>> import datetime
>>> from hindu_calendar import HinduCalendar
>>> cal =HinduCalendar[method='marathi']
>>> cal.find_city['Mumbai']
>>> cal.set_city['1275339', 'Mumbai']
>>> today = datetime.datetime.today[].strftime["%d/%m/%Y"]
>>> cal.find_date[today]
>>> cal.find_occurrence['15/08/1947', year='2020']
2 nếu cột >>> import datetime
>>> from hindu_calendar import HinduCalendar
>>> cal =HinduCalendar[method='marathi']
>>> cal.find_city['Mumbai']
>>> cal.set_city['1275339', 'Mumbai']
>>> today = datetime.datetime.today[].strftime["%d/%m/%Y"]
>>> cal.find_date[today]
>>> cal.find_occurrence['15/08/1947', year='2020']
3 chứa ngày ở định dạng khu vực. Điều này có thể hữu ích cho âm mưu lễ hội. Cờ >>> import datetime
>>> from hindu_calendar import HinduCalendar
>>> cal =HinduCalendar[method='marathi']
>>> cal.find_city['Mumbai']
>>> cal.set_city['1275339', 'Mumbai']
>>> today = datetime.datetime.today[].strftime["%d/%m/%Y"]
>>> cal.find_date[today]
>>> cal.find_occurrence['15/08/1947', year='2020']
4 được sử dụng để xác định xem hàng đó có được xử lý hay không. Giá trị >>> import datetime
>>> from hindu_calendar import HinduCalendar
>>> cal =HinduCalendar[method='marathi']
>>> cal.find_city['Mumbai']
>>> cal.set_city['1275339', 'Mumbai']
>>> today = datetime.datetime.today[].strftime["%d/%m/%Y"]
>>> cal.find_date[today]
>>> cal.find_occurrence['15/08/1947', year='2020']
2 cho biết hàng sẽ được xử lý và một sự kiện sẽ được tạo. Giá trị >>> import datetime
>>> from hindu_calendar import HinduCalendar
>>> cal =HinduCalendar[method='marathi']
>>> cal.find_city['Mumbai']
>>> cal.set_city['1275339', 'Mumbai']
>>> today = datetime.datetime.today[].strftime["%d/%m/%Y"]
>>> cal.find_date[today]
>>> cal.find_occurrence['15/08/1947', year='2020']
6 cho biết hàng sẽ bị bỏ qua>>> import datetime
>>> from hindu_calendar import HinduCalendar
>>> cal =HinduCalendar[method='marathi']
>>> cal.find_city['Mumbai']
>>> cal.set_city['1275339', 'Mumbai']
>>> today = datetime.datetime.today[].strftime["%d/%m/%Y"]
>>> cal.find_date[today]
>>> cal.find_occurrence['15/08/1947', year='2020']
7Điều này sẽ đi qua từng mục của
>>> import datetime
>>> from hindu_calendar import HinduCalendar
>>> cal =HinduCalendar[method='marathi']
>>> cal.find_city['Mumbai']
>>> cal.set_city['1275339', 'Mumbai']
>>> today = datetime.datetime.today[].strftime["%d/%m/%Y"]
>>> cal.find_date[today]
>>> cal.find_occurrence['15/08/1947', year='2020']
0, tìm ra Tithi trên >>> import datetime
>>> from hindu_calendar import HinduCalendar
>>> cal =HinduCalendar[method='marathi']
>>> cal.find_city['Mumbai']
>>> cal.set_city['1275339', 'Mumbai']
>>> today = datetime.datetime.today[].strftime["%d/%m/%Y"]
>>> cal.find_date[today]
>>> cal.find_occurrence['15/08/1947', year='2020']
3 là gì và sau đó xác định Tithi trong năm hiện tại [hoặc năm được chỉ định bằng cờ usage: hcal [-h] [-d date] [-f] [-r] [-m M] [-c] [-y year] [-l] [-s]
Hindu Calendar Utilities
optional arguments:
-h, --help show this help message and exit
-d date Date in dd/mm/yyyy
-f Fresh configuration
-r Input regional date
-m M Regional method to use
-c Find re-occurrence of Tithi of the 'date' in the current year
-y year Use with '-c' to specify year
-l Display in regional language
-s Show config and exit
8]Cuối cùng, tất cả những sự kiện này sẽ được ghi vào tệp .ics
có thể được nhập vào nhiều lịch khác nhau, chẳng hạn như Lịch Google