Beispiel #1
0
def get_spreadsheet(sheet_name=None):
    gc = pygsheets.authorize()

    try:
        sh = gc.open(sheet_name)
    except pygsheets.SpreadsheetNotFound:
        if sheet_name:
            query = f'name contains "{sheet_name.split()[0].lower()}"'
        else:
            query = ""
        spreadsheets = gc.spreadsheet_titles(query=query)
        while not spreadsheets:
            if bullet.YesNo(
                    prompt=
                    "Could not find spreadsheet. Do you want to create one?"):
                return gc.create(sheet_name)
            prompt = bullet.Input(
                prompt="Here are the sheets we found: Enter your query: ")
            query = prompt.launch()
            spreadsheets = gc.spreadsheet_titles(
                query=f'name contains "{query.lower()}"')
        prompt = bullet.Bullet(choices=spreadsheets,
                               prompt="Spreadsheet Names (Closest Match):")
        sheet_name = prompt.launch()
        sh = gc.open(sheet_name)

    return sh
def setup_account(data):
    print_wrapped(
        _("Log in to your Facebook (Messenger) account\n"
          "-------------------------------------------"))
    print()
    if data.session_path.exists():
        print_wrapped(
            _("We find that you have successfully logged in once before. "
              "You don't need to log in again if everything is already "
              "working properly."))

        widget = bullet.YesNo(prompt=_("Do you want to log in again? "),
                              prompt_prefix="[yN] ",
                              default="n")
        if not widget.launch():
            return
    run(data.instance_id, data.profile)
def delete(content_manager, argv):
    if len(argv) < 1:
        fuck_off()

    post_id = os.path.basename(argv[0])
    post = content_manager.find_post(post_id)

    if post is None:
        print("Unknown post")
        return

    sure = bullet.YesNo("Are you sure? ").launch()

    if sure:
        content_manager.delete_post(post)
        print("Post deleted")
    else:
        print("Aborting")
Beispiel #4
0
    def question_to_prompt(self, question: dict):
        self.prompt_to_questions[question.get("prompt")] = question

        question_type = question.get("type", None)

        if question_type is None or question_type not in self.types:
            raise InvalidBlueprint(f"Invalid question type: {question_type}")

        if question_type == "input":
            return bullet.Input(question["prompt"])
        if question_type == "number":
            return bullet.Numbers(question["prompt"])
        if question_type == "boolean":
            return bullet.YesNo(question["prompt"])
        if question_type == "password":
            return bullet.Password(question["prompt"])
        if question_type == "select":
            return bullet.Bullet(question["prompt"],
                                 choices=self.extract_names(
                                     question.get("values", [])))
        if question_type == "multiselect":
            return bullet.Check(question["prompt"],
                                choices=self.extract_names(
                                    question.get("values", [])))
Beispiel #5
0
if __name__ == "__main__":
    i = os.path.split(os.path.abspath(__file__))[0] + '/'
    sys.path.append(i)
    c = [
        '1 - Download & convert to JSON.',  # To JSON
        '2 - Update JSON',
        '3 - Select and Edit JSON.',
        '4 - Edit JSON without marauder data.'
    ]
    path = i + "json-output/"
    choice = prompt(items=c, prompt="Select a action.")
    choice = choice[:1]

    if choice == '1':
        q = b.YesNo(prompt="Are you sure? ").launch()
        if not q:  # No
            exit()
        _json()
        exit()
    elif choice == '2':
        q = b.YesNo(prompt="Are you sure? ").launch()
        if not q:
            exit()
        _json(location=path, update=True)
        exit()
    elif choice == '3':
        _convert(location=path)
        exit()
    elif choice == '4':
        for m in sorted(glob.glob(path + '*')):
Beispiel #6
0
def stream_info(streams,det):

  print(Fore.LIGHTGREEN_EX)
  vInfo = lambda streams, i : print(
        f"Codec Type = video\n"
        f"Codec Name = {streams[i]['codec_name']}\n"
        f"Codec Long Name = {streams[i]['codec_long_name']}\n"
        f"Profile = {streams[i]['profile']}\n"
        f"Width = {streams[i]['width']}\n"
        f"Height = {streams[i]['height']}\n"
        f"Aspect Ratio = {streams[i]['display_aspect_ratio']}\n"
        f"Average Frame Rate = { int(streams[i]['avg_frame_rate'].split('/')[0]) / int(streams[i]['avg_frame_rate'].split('/')[1])}\n"
        f"Pixel Format = {streams[i]['pix_fmt']}\n"
) # The weird {} calculates average frame rate

  aInfo = lambda streams, i : print(
          f"Codec Type = audio\n"
          f"Codec Name = {streams[i]['codec_name']}\n"
          f"Codec Long Name = {streams[i]['codec_long_name']}\n"
          f"Sample Format = {streams[i]['sample_fmt']}\n"
          f"Sample Rate = {streams[i]['sample_rate']}\n"
          f"Channels = {streams[i]['channels']}\n"
          f"Channel Layout = {streams[i]['channel_layout']}\n"
  )

  sInfo = lambda streams, i : print(
          f"Codec Type = subtitle\n"
          f"Codec Name = {streams[i]['codec_name']}\n"
          f"Codec Long Name = {streams[i]['codec_long_name']}\n"
          f"Duration = {float(streams[i]['duration'])/60} mins\n"
  )

  nl = "\n" # fstrings can't use backslashes T_T
  atInfo = lambda streams, i : print(
          f"Codec Type = attachment\n"
          f"Tags :-\n"
          f"{nl.join([f'''{n} = {streams[i]['tags'][n]}''' for n in streams[i]['tags'].keys()])}"
  )

  index = {
          'video': [],
          'audio': [],
          'subtitle': [],
          'attachment': []
          }

  for i in range(len(streams)):
      
      codecType = streams[i]['codec_type']

      if (codecType == 'video'):
          index['video'] += [i]
      elif (codecType == 'audio'):
          index['audio'] += [i]
      elif (codecType == 'subtitle'):
          index['subtitle'] += [i]
      elif (codecType == 'attachment'):
          index['attachment'] += [i]

  print("\nInfo Retrieved")
  print("-"*14)
  print(
          f"Filename = {det['filename']}"
          f"\nNum. of Streams = {det['nb_streams']}"
          f"\nFormat = {det['format_long_name']}"
          f"\nDuration = {float(det['duration'])/60} mins\n"
          )
  print(Fore.RED+"Continue? ")
  check = bullet.YesNo(Fore.RED+"Continue? ").launch()

  if (not check):
      print("Thank You For Opening This Program !")
      exit()

  system('clear')
  stay = True
  main_prompt(stay)
Beispiel #7
0
        index['audio'] += [i]
    elif (codecType == 'subtitle'):
        index['subtitle'] += [i]
    elif (codecType == 'attachment'):
        index['attachment'] += [i]

print("\nInfo Retrieved")
print("-"*14)
print(
        f"Filename = {det['filename']}"
        f"\nNum. of Streams = {det['nb_streams']}"
        f"\nFormat = {det['format_long_name']}"
        f"\nDuration = {float(det['duration'])/60} mins\n"
        )

check = bullet.YesNo("Continue?").launch()

if (not check):
    print("Thank You For Opening This Program !")
    exit()

system('clear')
stay = True

# Main Prompt
cli_main = bullet.Bullet(
        prompt = "\nCurrent Location : Home\n\nOptions :-",
        choices = ['File Info', 'Streams', 'Video', 'Audio', 'Subtitles', 'Attachments', 'Quit']
        )

while (stay):