From af41b8a07eb0b0a0c650e55b2e489b898ca32c2c Mon Sep 17 00:00:00 2001 From: imaheshwarans Date: Sun, 19 Nov 2023 19:05:10 +0530 Subject: [PATCH] initial commit --- amit.json | 1402 +++++++++++++++++++++++++++++++++++++++++++++++++++ chatg.go | 406 +++++++++++++++ errors | 10 + great.json | 674 +++++++++++++++++++++++++ main.go | 91 ++++ robert.json | 87 ++++ 6 files changed, 2670 insertions(+) create mode 100644 amit.json create mode 100644 chatg.go create mode 100644 errors create mode 100644 great.json create mode 100644 main.go create mode 100644 robert.json diff --git a/amit.json b/amit.json new file mode 100644 index 0000000..9e03050 --- /dev/null +++ b/amit.json @@ -0,0 +1,1402 @@ +{ + "url": "amitabh-bachchan", + "type": "Person", + "name": "Amitabh Bachchan", + "movies": [ + { + "name": "Aankhen 2", + "url": "aankhen-2", + "role": "Supporting Actor" + }, + { + "name": "Arasuri Maa Ambe", + "url": "arasuri-maa-ambe", + "role": "Actor" + }, + { + "name": "Badlaa", + "url": "badlaa", + "role": "Actor" + }, + { + "name": "Jhony Mastana", + "url": "jhony-mastana", + "role": "Actor" + }, + { + "name": "Kabira", + "url": "kabira", + "role": "Special Appearance" + }, + { + "name": "Kalpvriksh", + "url": "kalpvriksh", + "role": "Actor" + }, + { + "name": "Leader", + "url": "leader-2014-hindi", + "role": "Actor" + }, + { + "name": "Mehrunissa", + "url": "mehrunissa", + "role": "Actor" + }, + { + "name": "Pehle Aap Janab", + "url": "pehle-aap-janab", + "role": "Supporting Actor" + }, + { + "name": "Power", + "url": "power-2014-hindi", + "role": "Actor" + }, + { + "name": "Shoebite", + "url": "shoebite", + "role": "Actor" + }, + { + "name": "Taalismaan", + "url": "taalismaan", + "role": "Actor" + }, + { + "name": "Yudh", + "url": "yudh", + "role": "Actor" + }, + { + "name": "Pink", + "url": "pink-2016-hindi", + "role": "Actor" + }, + { + "name": "TE3N", + "url": "te3n", + "role": "Actor" + }, + { + "name": "Ki \u0026 Ka", + "url": "ki-and-ka", + "role": "Special Appearance" + }, + { + "name": "Wazir", + "url": "wazir", + "role": "Actor" + }, + { + "name": "Piku", + "url": "piku", + "role": "Actor" + }, + { + "name": "Hey Bro", + "url": "hey-bro", + "role": "Special Appearance" + }, + { + "name": "Shamitabh", + "url": "shamitabh", + "role": "Actor" + }, + { + "name": "Manam", + "url": "manam", + "role": "Special Appearance" + }, + { + "name": "Bhoothnath Returns", + "url": "bhoothnath-returns", + "role": "Actor" + }, + { + "name": "Sholay 3D", + "url": "sholay-3d", + "role": "Actor" + }, + { + "name": "Mahabharat", + "url": "mahabharat", + "role": "Actor" + }, + { + "name": "Satyagraha", + "url": "satyagraha", + "role": "Actor" + }, + { + "name": "The Great Gatsby", + "url": "the-great-gatsby", + "role": "Supporting Actor" + }, + { + "name": "Bombay Talkies", + "url": "bombay-talkies", + "role": "Special Appearance" + }, + { + "name": "Naam Chhe Maru Ganga", + "url": "naam-chhe-maru-ganga", + "role": "Actor" + }, + { + "name": "Zamaanat", + "url": "zamaanat", + "role": "Actor" + }, + { + "name": "English Vinglish", + "url": "english-vinglish", + "role": "Special Appearance" + }, + { + "name": "Ganga Devi", + "url": "ganga-devi", + "role": "Actor" + }, + { + "name": "Bol Bachchan", + "url": "bol-bachchan", + "role": "Supporting Actor" + }, + { + "name": "Department", + "url": "department", + "role": "Supporting Actor" + }, + { + "name": "Mr Bhatti on Chutti", + "url": "mr-bhatti-on-chutti", + "role": "Supporting Actor" + }, + { + "name": "Bollywood: The Greatest Love Story Ever Told", + "url": "bollywood-the-greatest-love-story-ever-told", + "role": "Actor" + }, + { + "name": "Poet of Politics", + "url": "poet-of-politics", + "role": "Actor" + }, + { + "name": "Aarakshan", + "url": "aarakshan", + "role": "Supporting Actor" + }, + { + "name": "Bbuddah Hoga Terra Baap", + "url": "bbuddah-hoga-terra-baap", + "role": "Actor" + }, + { + "name": "Kandahar", + "url": "kandahar", + "role": "Supporting Actor" + }, + { + "name": "Teen Patti", + "url": "teen-patti", + "role": "Actor" + }, + { + "name": "Rann", + "url": "rann", + "role": "Actor" + }, + { + "name": "Twinergy", + "url": "twinergy", + "role": "Actor" + }, + { + "name": "Paa", + "url": "paa", + "role": "Supporting Actor" + }, + { + "name": "Aladin", + "url": "aladin", + "role": "Actor" + }, + { + "name": "Slumdog Millionaire", + "url": "slumdog-millionaire", + "role": "Special Appearance" + }, + { + "name": "Zor Lagaa Ke... Haiya!", + "url": "zor-lagaa-ke-haiya", + "role": "Supporting Actor" + }, + { + "name": "Delhi-6", + "url": "delhi-6", + "role": "Supporting Actor" + }, + { + "name": "The Last Lear", + "url": "the-last-lear", + "role": "Supporting Actor" + }, + { + "name": "God Tussi Great Ho", + "url": "god-tussi-great-ho", + "role": "Actor" + }, + { + "name": "Sarkar Raj", + "url": "sarkar-raj", + "role": "Supporting Actor" + }, + { + "name": "Bhoothnath", + "url": "bhoothnath", + "role": "Actor" + }, + { + "name": "Yaar Meri Zindagi", + "url": "yaar-meri-zindagi", + "role": "Actor" + }, + { + "name": "Jodhaa Akbar", + "url": "jodhaa-akbar", + "role": "Supporting Actor" + }, + { + "name": "Gangotri", + "url": "gangotri", + "role": "Actor" + }, + { + "name": "Om Shanti Om", + "url": "om-shanti-om", + "role": "Special Appearance" + }, + { + "name": "Ram Gopal Varma Ki Aag", + "url": "ram-gopal-varma-ki-aag", + "role": "Supporting Actor" + }, + { + "name": "Jhoom Barabar Jhoom", + "url": "jhoom-barabar-jhoom", + "role": "Supporting Actor" + }, + { + "name": "Swami", + "url": "swami", + "role": "Supporting Actor" + }, + { + "name": "Cheeni Kum", + "url": "cheeni-kum", + "role": "Actor" + }, + { + "name": "Shootout at Lokhandwala", + "url": "shootout-at-lokhandwala", + "role": "Supporting Actor" + }, + { + "name": "Nishabd", + "url": "nishabd", + "role": "Actor" + }, + { + "name": "Eklavya", + "url": "eklavya", + "role": "Actor" + }, + { + "name": "52nd Fair One Filmfare Awards", + "url": "52nd-fair-one-filmfare-awards", + "role": "Actor" + }, + { + "name": "Ek Krantiveer: Vasudev Balwant Phadke", + "url": "ek-krantiveer-vasudev-balwant-phadke", + "role": "Supporting Actor" + }, + { + "name": "Baabul", + "url": "baabul", + "role": "Supporting Actor" + }, + { + "name": "Ganga", + "url": "ganga", + "role": "Actor" + }, + { + "name": "Kabhi Alvida Naa Kehna", + "url": "kabhi-alvida-naa-kehna", + "role": "Supporting Actor" + }, + { + "name": "Darna Zaroori Hai", + "url": "darna-zaroori-hai", + "role": "Supporting Actor" + }, + { + "name": "Family: Ties of Blood", + "url": "family-ties-of-blood", + "role": "Supporting Actor" + }, + { + "name": "Ek Ajnabee", + "url": "ek-ajnabee", + "role": "Actor" + }, + { + "name": "Amrithadhare", + "url": "amrithadhare", + "role": "Special Appearance" + }, + { + "name": "Dil Jo Bhi Kahey...", + "url": "dil-jo-bhi-kahey", + "role": "Actor" + }, + { + "name": "Viruddh... Family Comes First", + "url": "viruddh-family-comes-first", + "role": "Actor" + }, + { + "name": "Sarkar", + "url": "sarkar", + "role": "Actor" + }, + { + "name": "Paheli", + "url": "paheli", + "role": "Actor" + }, + { + "name": "Parineeta", + "url": "parineeta", + "role": "Supporting Actor" + }, + { + "name": "Bunty Aur Babli", + "url": "bunty-aur-babli", + "role": "Supporting Actor" + }, + { + "name": "Waqt: The Race Against Time", + "url": "waqt-the-race-against-time", + "role": "Supporting Actor" + }, + { + "name": "Black", + "url": "black", + "role": "Actor" + }, + { + "name": "Ramji Londonwaley", + "url": "ramji-londonwaley", + "role": "Supporting Actor" + }, + { + "name": "Ab Tumhare Hawale Watan Saathiyo", + "url": "ab-tumhare-hawale-watan-saathiyo", + "role": "Actor" + }, + { + "name": "Veer-Zaara", + "url": "veer-zaara", + "role": "Special Appearance" + }, + { + "name": "Hum Kaun Hai?", + "url": "hum-kaun-hai", + "role": "Actor" + }, + { + "name": "Kyun! Ho Gaya Na...", + "url": "kyun-ho-gaya-na", + "role": "Supporting Actor" + }, + { + "name": "Deewaar: Let's Bring Our Heroes Home", + "url": "deewaar-lets-bring-our-heroes-home", + "role": "Supporting Actor" + }, + { + "name": "Lakshya", + "url": "lakshya", + "role": "Supporting Actor" + }, + { + "name": "Dev", + "url": "dev", + "role": "Supporting Actor" + }, + { + "name": "Insaaf: The Justice", + "url": "insaaf-the-justice", + "role": "Supporting Actor" + }, + { + "name": "Rudraksh", + "url": "rudraksh", + "role": "Supporting Actor" + }, + { + "name": "Aetbaar", + "url": "aetbaar", + "role": "Actor" + }, + { + "name": "Khakee", + "url": "khakee", + "role": "Supporting Actor" + }, + { + "name": "49th Manikchand Filmfare Awards 2003", + "url": "49th-manikchand-filmfare-awards-2003", + "role": "Actor" + }, + { + "name": "Fun2shh... Dudes in the 10th Century", + "url": "fun2shh-dudes-in-the-10th-century", + "role": "Supporting Actor" + }, + { + "name": "Baghban", + "url": "baghban", + "role": "Actor" + }, + { + "name": "Boom", + "url": "boom", + "role": "Actor" + }, + { + "name": "Mumbai Se Aaya Mera Dost", + "url": "mumbai-se-aaya-mera-dost", + "role": "Supporting Actor" + }, + { + "name": "Armaan", + "url": "armaan", + "role": "Actor" + }, + { + "name": "Khushi", + "url": "khushi-2003-hindi", + "role": "Supporting Actor" + }, + { + "name": "Kaante", + "url": "kaante", + "role": "Actor" + }, + { + "name": "Agni Varsha", + "url": "agni-varsha", + "role": "Special Appearance" + }, + { + "name": "Hum Kisi Se Kum Nahin", + "url": "hum-kisi-se-kum-nahin", + "role": "Actor, Actor" + }, + { + "name": "Aankhen", + "url": "aankhen", + "role": "Actor" + }, + { + "name": "Kabhi Khushi Kabhie Gham...", + "url": "kabhi-khushi-kabhie-gham", + "role": "Supporting Actor" + }, + { + "name": "Aks", + "url": "aks", + "role": "Actor" + }, + { + "name": "Lagaan", + "url": "lagaan", + "role": "Supporting Actor" + }, + { + "name": "Ek Rishtaa: The Bond of Love", + "url": "ek-rishtaa-the-bond-of-love", + "role": "Actor" + }, + { + "name": "Dafan", + "url": "dafan", + "role": "Supporting Actor" + }, + { + "name": "Mohabbatein", + "url": "mohabbatein", + "role": "Supporting Actor" + }, + { + "name": "International Indian Film Awards", + "url": "international-indian-film-awards", + "role": "Actor" + }, + { + "name": "Hello Brother", + "url": "hello-brother", + "role": "Supporting Actor" + }, + { + "name": "Kohram", + "url": "kohram", + "role": "Actor" + }, + { + "name": "Hindustan Ki Kasam", + "url": "hindustan-ki-kasam", + "role": "Supporting Actor" + }, + { + "name": "Biwi No. 1", + "url": "biwi-no-1", + "role": "Supporting Actor" + }, + { + "name": "Sooryavansham", + "url": "sooryavansham", + "role": "Actor" + }, + { + "name": "Lal Baadshah", + "url": "lal-baadshah", + "role": "Actor" + }, + { + "name": "Hero Hindustani", + "url": "hero-hindustani", + "role": "Supporting Actor" + }, + { + "name": "Bade Miyan Chote Miyan", + "url": "bade-miyan-chote-miyan", + "role": "Supporting Actor" + }, + { + "name": "Major Saab", + "url": "major-saab", + "role": "Supporting Actor" + }, + { + "name": "Mrityudaata", + "url": "mrityudaata", + "role": "Actor" + }, + { + "name": "Tere Mere Sapne", + "url": "tere-mere-sapne", + "role": "Supporting Actor" + }, + { + "name": "Insaniyat", + "url": "insaniyat", + "role": "Actor" + }, + { + "name": "Akkaa", + "url": "akka", + "role": "Supporting Actor" + }, + { + "name": "Professor Ki Padosan", + "url": "professor-ki-padosan", + "role": "Supporting Actor" + }, + { + "name": "Zulm Ki Hukumat", + "url": "zulm-ki-hukumat", + "role": "Supporting Actor" + }, + { + "name": "Khuda Gawah", + "url": "khuda-gawah", + "role": "Actor" + }, + { + "name": "Akayla", + "url": "akayla", + "role": "Actor" + }, + { + "name": "Indrajeet", + "url": "indrajeet", + "role": "Actor" + }, + { + "name": "Ajooba", + "url": "ajooba", + "role": "Actor" + }, + { + "name": "Hum", + "url": "hum", + "role": "Actor" + }, + { + "name": "Aaj Ka Arjun", + "url": "aaj-ka-arjun", + "role": "Actor" + }, + { + "name": "Kroadh", + "url": "kroadh", + "role": "Supporting Actor" + }, + { + "name": "Agneepath", + "url": "agneepath-1990-hindi", + "role": "Actor" + }, + { + "name": "Main Azaad Hoon", + "url": "main-azaad-hoon", + "role": "Actor" + }, + { + "name": "Jadugar", + "url": "jadugar", + "role": "Actor" + }, + { + "name": "Batwara", + "url": "batwara", + "role": "Supporting Actor" + }, + { + "name": "Toofan", + "url": "toofan-1989-hindi", + "role": "Actor" + }, + { + "name": "Ganga Jamuna Saraswathi", + "url": "ganga-jamuna-saraswathi", + "role": "Actor" + }, + { + "name": "Gangaa Jamunaa Saraswathi", + "url": "gangaa-jamunaa-saraswathi", + "role": "Actor" + }, + { + "name": "Soorma Bhopali", + "url": "soorma-bhopali", + "role": "Actor" + }, + { + "name": "Shahenshah", + "url": "shahenshah", + "role": "Actor" + }, + { + "name": "Jalwa", + "url": "jalwa", + "role": "Supporting Actor" + }, + { + "name": "Dosti Dushmani", + "url": "dosti-dushmani", + "role": "Special Appearance" + }, + { + "name": "Aakhree Raasta", + "url": "aakhree-raasta", + "role": "Actor" + }, + { + "name": "Mard", + "url": "mard", + "role": "Actor" + }, + { + "name": "Geraftaar", + "url": "geraftaar", + "role": "Special Appearance" + }, + { + "name": "Ghulami", + "url": "ghulami", + "role": "Supporting Actor" + }, + { + "name": "Sharaabi", + "url": "sharabi", + "role": "Actor" + }, + { + "name": "Inquilaab", + "url": "inquilaab", + "role": "Actor" + }, + { + "name": "Kanoon Kya Karega", + "url": "2689e784c79364fc9fd8f0d136de8a41", + "role": "Supporting Actor" + }, + { + "name": "Paan Khaye Saiyan Hamaar", + "url": "paan-khaye-saiyan-hamaar", + "role": "Supporting Actor" + }, + { + "name": "Coolie", + "url": "coolie", + "role": "Actor" + }, + { + "name": "Mahaan", + "url": "mahaan", + "role": "Actor" + }, + { + "name": "Andhaa Kanoon", + "url": "andhaa-kanoon", + "role": "Special Appearance" + }, + { + "name": "Nastik", + "url": "nastik", + "role": "Actor" + }, + { + "name": "Pukar", + "url": "pukar", + "role": "Actor" + }, + { + "name": "Shakti", + "url": "shakti-1982-hindi", + "role": "Actor" + }, + { + "name": "Desh Premee", + "url": "desh-premee", + "role": "Actor" + }, + { + "name": "Bemisal", + "url": "bemisal", + "role": "Actor" + }, + { + "name": "Satte Pe Satta", + "url": "satte-pe-satta", + "role": "Actor" + }, + { + "name": "Khud-Daar", + "url": "khud-daar", + "role": "Actor" + }, + { + "name": "Namak Halal", + "url": "namak-halal", + "role": "Actor" + }, + { + "name": "Kaalia", + "url": "kaalia", + "role": "Actor" + }, + { + "name": "Silsila", + "url": "silsila", + "role": "Actor" + }, + { + "name": "Laawaris", + "url": "laawaris", + "role": "Actor" + }, + { + "name": "Naseeb", + "url": "naseeb", + "role": "Actor" + }, + { + "name": "Barsaat Ki Ek Raat", + "url": "barsaat-ki-ek-raat", + "role": "Actor" + }, + { + "name": "Yaarana", + "url": "yaarana-b785", + "role": "Actor" + }, + { + "name": "Chashme Buddoor", + "url": "chashme-buddoor", + "role": "Special Appearance" + }, + { + "name": "Commander", + "url": "commander", + "role": "Supporting Actor" + }, + { + "name": "Vilayati Babu", + "url": "vilayati-babu", + "role": "Actor" + }, + { + "name": "Shaan", + "url": "shaan-1980-hindi", + "role": "Actor" + }, + { + "name": "Ram Balram", + "url": "ram-balram", + "role": "Actor" + }, + { + "name": "Dostana", + "url": "dostana-1980-hindi", + "role": "Actor" + }, + { + "name": "Do Aur Do Paanch", + "url": "do-aur-do-paanch", + "role": "Actor" + }, + { + "name": "Suhaag", + "url": "suhaag-1979-hindi", + "role": "Actor" + }, + { + "name": "Kala Patthar", + "url": "kala-patthar", + "role": "Actor" + }, + { + "name": "Mr Natwarlal", + "url": "mr-natwarlal", + "role": "Actor" + }, + { + "name": "Manzil", + "url": "manzil", + "role": "Actor" + }, + { + "name": "Jurmana", + "url": "jurmana", + "role": "Actor" + }, + { + "name": "Golmaal", + "url": "golmaal", + "role": "Special Appearance" + }, + { + "name": "The Great Gambler", + "url": "the-great-gambler", + "role": "Actor" + }, + { + "name": "Ahsaas", + "url": "ahsaas", + "role": "Special Appearance" + }, + { + "name": "Muqaddar Ka Sikandar", + "url": "muqaddar-ka-sikandar", + "role": "Actor" + }, + { + "name": "Trishul", + "url": "trishul-1978-hindi", + "role": "Actor" + }, + { + "name": "Don", + "url": "don-1978-hindi", + "role": "Actor" + }, + { + "name": "Kasme Vaade", + "url": "kasme-vaade", + "role": "Actor" + }, + { + "name": "Besharam", + "url": "besharam-1978-hindi", + "role": "Actor" + }, + { + "name": "Ganga Ki Saugand", + "url": "ganga-ki-saugand", + "role": "Actor" + }, + { + "name": "Cinema Cinema", + "url": "cinema-cinema-1978-hindi", + "role": "Actor" + }, + { + "name": "Chala Murari Hero Banne", + "url": "chala-murari-hero-banne", + "role": "Special Appearance" + }, + { + "name": "Parvarish", + "url": "parvarish", + "role": "Actor" + }, + { + "name": "Charandas", + "url": "charandas", + "role": "Actor" + }, + { + "name": "Shatranj Ke Khilari", + "url": "shatranj-ke-khilari", + "role": "Supporting Actor" + }, + { + "name": "Khoon Pasina", + "url": "khoon-pasina", + "role": "Actor" + }, + { + "name": "Amar Akbar Anthony", + "url": "amar-akbar-anthony-1977-hindi", + "role": "Actor" + }, + { + "name": "Imaan Dharam", + "url": "imaan-dharam", + "role": "Actor" + }, + { + "name": "Alaap", + "url": "alaap", + "role": "Actor" + }, + { + "name": "Balika Badhu", + "url": "balika-badhu", + "role": "Supporting Actor" + }, + { + "name": "Adalat", + "url": "adalat", + "role": "Actor" + }, + { + "name": "Do Anjaane", + "url": "do-anjaane", + "role": "Actor" + }, + { + "name": "Hera Pheri", + "url": "hera-pheri-ecfa", + "role": "Actor" + }, + { + "name": "Kabhi Kabhi", + "url": "kabhi-kabhi", + "role": "Supporting Actor" + }, + { + "name": "Chhoti Si Baat", + "url": "chhoti-si-baat", + "role": "Special Appearance" + }, + { + "name": "Faraar", + "url": "faraar", + "role": "Actor" + }, + { + "name": "Sholay", + "url": "sholay", + "role": "Actor" + }, + { + "name": "Mili", + "url": "mili-1975-hindi", + "role": "Actor" + }, + { + "name": "Chupke Chupke", + "url": "chupke-chupke", + "role": "Actor" + }, + { + "name": "Zameer", + "url": "zameer", + "role": "Actor" + }, + { + "name": "Deewar", + "url": "deewar", + "role": "Actor" + }, + { + "name": "Majboor", + "url": "majboor", + "role": "Actor" + }, + { + "name": "Kunwara Baap", + "url": "kunwara-baap", + "role": "Supporting Actor" + }, + { + "name": "Benaam", + "url": "6dcce2fd44cf475ffd71429dc1d176f2", + "role": "Actor" + }, + { + "name": "Roti Kapda Aur Makaan", + "url": "roti-kapda-aur-makaan", + "role": "Supporting Actor" + }, + { + "name": "Kasauti", + "url": "kasauti", + "role": "Actor" + }, + { + "name": "Dost", + "url": "dost", + "role": "Supporting Actor" + }, + { + "name": "Namak Haram", + "url": "namak-haram", + "role": "Actor" + }, + { + "name": "Saudagar", + "url": "saudagar", + "role": "Actor" + }, + { + "name": "Abhimaan", + "url": "abhimaan", + "role": "Actor" + }, + { + "name": "Gehri Chaal", + "url": "gehri-chaal", + "role": "Actor" + }, + { + "name": "Bandhe Haath", + "url": "bandhe-haath", + "role": "Actor" + }, + { + "name": "Zanjeer", + "url": "zanjeer-1973-hindi", + "role": "Actor" + }, + { + "name": "Bawarchi", + "url": "bawarchi", + "role": "Supporting Actor" + }, + { + "name": "Garam Masala", + "url": "garam-masala-1972-hindi", + "role": "Supporting Actor" + }, + { + "name": "Reshma Aur Shera", + "url": "reshma-aur-shera", + "role": "Supporting Actor" + }, + { + "name": "Bombay to Goa", + "url": "bombay-to-goa", + "role": "Actor" + }, + { + "name": "Piya Ka Ghar", + "url": "piya-ka-ghar", + "role": "Supporting Actor" + }, + { + "name": "Bansi Birju", + "url": "bansi-birju", + "role": "Actor" + }, + { + "name": "Ek Nazar", + "url": "ek-nazar", + "role": "Actor" + }, + { + "name": "Jaban", + "url": "49e7500edec04e9d1fb2b0a96a30f12f", + "role": "Supporting Actor" + }, + { + "name": "Raaste Ka Patthar", + "url": "raaste-ka-patthar", + "role": "Actor" + }, + { + "name": "Pyar Ki Kahani", + "url": "pyar-ki-kahani", + "role": "Actor" + }, + { + "name": "Anand", + "url": "anand-1971-hindi", + "role": "Supporting Actor" + }, + { + "name": "Parwana", + "url": "parwana", + "role": "Actor" + }, + { + "name": "Sanjog", + "url": "sanjog", + "role": "Actor" + }, + { + "name": "Saat Hindustani", + "url": "saat-hindustani", + "role": "Supporting Actor" + }, + { + "name": "TE3N", + "url": "te3n", + "role": "Playback Singer" + }, + { + "name": "Wazir", + "url": "wazir", + "role": "Playback Singer" + }, + { + "name": "Shamitabh", + "url": "shamitabh", + "role": "Playback Singer" + }, + { + "name": "Bol Bachchan", + "url": "bol-bachchan", + "role": "Playback Singer" + }, + { + "name": "Kahaani", + "url": "kahaani", + "role": "Playback Singer" + }, + { + "name": "Paa", + "url": "paa", + "role": "Playback Singer" + }, + { + "name": "Aladin", + "url": "aladin", + "role": "Playback Singer" + }, + { + "name": "Bhoothnath", + "url": "bhoothnath", + "role": "Playback Singer" + }, + { + "name": "Ram Gopal Varma Ki Aag", + "url": "ram-gopal-varma-ki-aag", + "role": "Playback Singer" + }, + { + "name": "Nishabd", + "url": "nishabd", + "role": "Playback Singer" + }, + { + "name": "Baabul", + "url": "baabul", + "role": "Playback Singer" + }, + { + "name": "Sarkar", + "url": "sarkar", + "role": "Playback Singer" + }, + { + "name": "Aetbaar", + "url": "aetbaar", + "role": "Playback Singer, Playback Singer" + }, + { + "name": "Baghban", + "url": "baghban", + "role": "Playback Singer" + }, + { + "name": "Armaan", + "url": "armaan", + "role": "Playback Singer" + }, + { + "name": "Kabhi Khushi Kabhie Gham...", + "url": "kabhi-khushi-kabhie-gham", + "role": "Playback Singer" + }, + { + "name": "Aks", + "url": "aks", + "role": "Playback Singer" + }, + { + "name": "Sooryavansham", + "url": "sooryavansham", + "role": "Playback Singer" + }, + { + "name": "Lal Baadshah", + "url": "lal-baadshah", + "role": "Playback Singer" + }, + { + "name": "Khuda Gawah", + "url": "khuda-gawah", + "role": "Playback Singer" + }, + { + "name": "Main Azaad Hoon", + "url": "main-azaad-hoon", + "role": "Playback Singer" + }, + { + "name": "Jadugar", + "url": "jadugar", + "role": "Playback Singer" + }, + { + "name": "Sharaabi", + "url": "sharabi", + "role": "Playback Singer" + }, + { + "name": "Mahaan", + "url": "mahaan", + "role": "Playback Singer" + }, + { + "name": "Laawaris", + "url": "laawaris", + "role": "Playback Singer" + }, + { + "name": "Amar Akbar Anthony", + "url": "amar-akbar-anthony-1977-hindi", + "role": "Playback Singer" + }, + { + "name": "Kabhi Kabhi", + "url": "kabhi-kabhi", + "role": "Playback Singer" + }, + { + "name": "Mili", + "url": "mili-1975-hindi", + "role": "Playback Singer" + }, + { + "name": "Shamitabh", + "url": "shamitabh", + "role": "Producer" + }, + { + "name": "Bbuddah Hoga Terra Baap", + "url": "bbuddah-hoga-terra-baap", + "role": "Producer" + }, + { + "name": "Twinergy", + "url": "twinergy", + "role": "Producer" + }, + { + "name": "Viruddh... Family Comes First", + "url": "viruddh-family-comes-first", + "role": "Producer" + }, + { + "name": "Aks", + "url": "aks", + "role": "Producer" + }, + { + "name": "Major Saab", + "url": "major-saab", + "role": "Producer" + }, + { + "name": "Saat Rang Ke Sapne", + "url": "saat-rang-ke-sapne", + "role": "Producer" + }, + { + "name": "Ullaasam", + "url": "ullaasam", + "role": "Producer" + }, + { + "name": "Mrityudaata", + "url": "mrityudaata", + "role": "Producer" + }, + { + "name": "Tere Mere Sapne", + "url": "tere-mere-sapne", + "role": "Producer" + }, + { + "name": "Krantiveer-The Revolution", + "url": "krantiveer-the-revolution", + "role": "Thanks" + }, + { + "name": "Zor Lagaa Ke... Haiya!", + "url": "zor-lagaa-ke-haiya", + "role": "Thanks" + }, + { + "name": "Delhi-6", + "url": "delhi-6", + "role": "Thanks" + }, + { + "name": "Jodhaa Akbar", + "url": "jodhaa-akbar", + "role": "Thanks" + }, + { + "name": "Gangotri", + "url": "gangotri", + "role": "Thanks" + }, + { + "name": "Lagaan", + "url": "lagaan", + "role": "Special Thanks" + } + ] +} \ No newline at end of file diff --git a/chatg.go b/chatg.go new file mode 100644 index 0000000..e4f0b27 --- /dev/null +++ b/chatg.go @@ -0,0 +1,406 @@ +package main + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "os" + "sync" + "time" +) + +const moviebuffURL = "https://data.moviebuff.com/%s" + +type Movie struct { + URL string `json:"url"` + Name string `json:"name"` + Type string `json:"type"` + Cast []Role `json:"cast"` + Crew []Role `json:"crew"` +} + +type Role struct { + Name string `json:"name"` + URL string `json:"url"` + Role string `json:"role"` +} + +type Person struct { + URL string `json:"url"` + Name string `json:"name"` + Type string `json:"type"` + Movies []Role `json:"movies"` +} + +func fetchPersonData(url string) (*Person, error) { + resp, err := http.Get(url) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + // fmt.Println(url) + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("failed to fetch data from %s: %s", url, resp.Status) + } + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + var person Person + err = json.Unmarshal(body, &person) + if err != nil { + return nil, err + } + + return &person, nil +} + +func fetchMovieData(url string) (*Movie, error) { + resp, err := http.Get(url) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + // fmt.Println(url) + + if resp.StatusCode != http.StatusOK { + // return nil, fmt.Errorf("failed to fetch data from %s: %s", url, resp.Status) + fmt.Errorf("failed to fetch info for ", url) + return nil, nil + } + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + var movie Movie + err = json.Unmarshal(body, &movie) + if err != nil { + return nil, err + } + + return &movie, nil +} + +// Movie[the-great-gatsby]=[]cast,crew +var MovieMap map[string]Movie + +// Person[amitabh-bachchan]=[]movies +var PersonMap map[string][]Movie + +var wg sync.WaitGroup + +// var CrewMap map[string][]Role + +var visited map[string]bool +var queue [][]*Person + +func init() { + visited = make(map[string]bool) + queue = make([][]*Person, 0) + MovieMap = make(map[string]Movie) + + PersonMap = make(map[string][]Movie) +} + +func findDegreesOfSeparation(start, end string) ([]*Person, error) { + + var mu sync.Mutex + + // var result []*Person + + startPerson, err := fetchPersonData(fmt.Sprintf(moviebuffURL, start)) + if err != nil { + return nil, err + } + + // endPerson, err := fetchPersonData(fmt.Sprintf(moviebuffURL, end)) + // if err != nil { + // return nil, err + // } + + for _, movie := range startPerson.Movies { + thisMovie, err := fetchMovieData(fmt.Sprintf(moviebuffURL, movie.URL)) + if err != nil { + return nil, err + } + if thisMovie == nil { + continue + } + + if _, seen := MovieMap[movie.URL]; !seen { + MovieMap[movie.URL] = *thisMovie + } + if _, seen := PersonMap[startPerson.URL]; !seen { + PersonMap[startPerson.URL] = append(PersonMap[startPerson.URL], *thisMovie) + } + for _, crew := range thisMovie.Crew { + if _, seen := PersonMap[crew.URL]; !seen { + PersonMap[startPerson.URL] = append(PersonMap[startPerson.URL], *thisMovie) + } + + } + } + + fmt.Println("After calculating first person") + fmt.Println("length of moviemap -> ", len(MovieMap)) + fmt.Println("length of personmap -> ", len(PersonMap)) + + wg.Add(5) + go func() { + mu.Lock() + movies, seen := PersonMap[end] + if seen { + defer wg.Done() + fmt.Println("end person is found") + fmt.Println("movie list -> ", movies) + } + + for _, movie := range MovieMap { + for _, person := range movie.Cast { + if _, seen := PersonMap[person.URL]; seen { + continue + } + thisPerson, err := fetchPersonData(fmt.Sprintf(moviebuffURL, person.URL)) + if thisPerson == nil { + continue + } + if err != nil { + fmt.Println("failed to fetch person - >", thisPerson.Name) + } + + PersonMap[thisPerson.URL] = append(PersonMap[thisPerson.URL], movie) + } + } + mu.Unlock() + time.Sleep(1 * time.Minute) + }() + + go func() { + mu.Lock() + movies, seen := PersonMap[end] + if seen { + defer wg.Done() + fmt.Println("end person is found") + fmt.Println("movie list -> ", movies) + } + + for _, movie := range MovieMap { + for _, person := range movie.Crew { + if _, seen := PersonMap[person.URL]; seen { + continue + } + thisPerson, err := fetchPersonData(fmt.Sprintf(moviebuffURL, person.URL)) + if thisPerson == nil { + continue + } + if err != nil { + fmt.Println("failed to fetch person - >", thisPerson.Name) + } + PersonMap[thisPerson.URL] = append(PersonMap[thisPerson.URL], movie) + } + } + mu.Unlock() + time.Sleep(1 * time.Minute) + }() + + go func() { + mu.Lock() + movies, seen := PersonMap[end] + if seen { + defer wg.Done() + fmt.Println("end person is found") + fmt.Println("movie list -> ", movies) + } + + for _, movies := range PersonMap { + for _, movie := range movies { + if _, seen := MovieMap[movie.URL]; seen { + continue + } + thisMovie, err := fetchMovieData(fmt.Sprintf(moviebuffURL, movie.URL)) + if err != nil { + fmt.Println("failed to fetch movie info -> ", movie.URL) + } + if thisMovie == nil { + continue + } + + MovieMap[movie.URL] = *thisMovie + if _, seen := PersonMap[startPerson.URL]; !seen { + PersonMap[startPerson.URL] = append(PersonMap[startPerson.URL], *thisMovie) + } + for _, crew := range thisMovie.Crew { + if _, seen := PersonMap[crew.URL]; !seen { + PersonMap[startPerson.URL] = append(PersonMap[startPerson.URL], *thisMovie) + } + + } + } + } + mu.Unlock() + time.Sleep(1 * time.Minute) + }() + + go func() { + + for { + mu.Lock() + movies, seen := PersonMap[end] + if seen { + defer wg.Done() + fmt.Println("end person is found") + fmt.Println("movie list -> ", movies) + } + fmt.Println("length of moviemap -> ", len(MovieMap)) + fmt.Println("length of personmap -> ", len(PersonMap)) + mu.Unlock() + time.Sleep(30 * time.Second) + } + + }() + + // write to file + go func() { + for { + mu.Lock() + personBytes := new(bytes.Buffer) + person := gob.NewEncoder(personBytes) + + // Encoding the map + err := person.Encode(PersonMap) + if err != nil { + panic(err) + } + + movieBytes := new(bytes.Buffer) + movie := gob.NewEncoder(movieBytes) + + // Encoding the map + err = person.Encode(movie) + if err != nil { + panic(err) + } + + if err := ioutil.WriteFile("personmap", personBytes.Bytes(), 777); err != nil { + fmt.Println("failed to write to file") + } + + if err := ioutil.WriteFile("moviemap", movieBytes.Bytes(), 777); err != nil { + fmt.Println("failed to write to file") + } + mu.Unlock() + time.Sleep(2 * time.Minute) + } + }() + + // match - find if end person is present in the person map + go func() { + for { + mu.Lock() + movies, seen := PersonMap[end] + if seen { + defer wg.Done() + fmt.Println("end person is found") + fmt.Println("movie list -> ", movies) + break + } + mu.Unlock() + time.Sleep(5 * time.Minute) + } + + }() + + // queue = append(queue, []*Person{startPerson}) + + // for len(queue) > 0 { + // currentPath := queue[0] + // queue = queue[1:] + + // currentPerson := currentPath[len(currentPath)-1] + + // if currentPerson.Name == end { + // return currentPath, nil + // } + + // if visited[currentPerson.Name] { + // continue + // } + + // visited[currentPerson.Name] = true + + // for _, movie := range currentPerson.Movies { + // movieURL := fmt.Sprintf(moviebuffURL, movie.URL) + // movieData, err := fetchMovieData(movieURL) + // if err != nil { + // return nil, err + // } + + // if movieData == nil { + // continue + // } + + // var relatedPeople []*Person + // for _, cast := range movieData.Cast { + // person, err := fetchPersonData(fmt.Sprintf(moviebuffURL, cast.URL)) + // if err != nil { + // return nil, err + // } + // relatedPeople = append(relatedPeople, person) + // } + + // // relatedPeople := []*Person{movieData} + + // for _, relatedPerson := range relatedPeople { + // if !visited[relatedPerson.Name] { + // newPath := append(currentPath, relatedPerson) + // queue = append(queue, newPath) + // } + // } + // } + + // } + + // return result, fmt.Errorf("no connection found between %s and %s", start, end) + + return nil, nil +} + +func main() { + if len(os.Args) != 3 { + fmt.Println("Usage: degrees ") + os.Exit(1) + } + + startPerson := os.Args[1] + endPerson := os.Args[2] + + result, err := findDegreesOfSeparation(startPerson, endPerson) + if err != nil { + fmt.Println("Error:", err) + os.Exit(1) + } + + wg.Wait() + + fmt.Printf("Degrees of Separation: %d\n", len(result)-1) + for i, person := range result { + fmt.Printf("%d. Movie: %s\n %s: %s\n", i+1, person.Movies, getPersonType(person), person.Name) + } +} + +func getPersonType(person *Person) string { + if len(person.Movies) > 0 { + return "Supporting Actor" + } + return "Actor" +} diff --git a/errors b/errors new file mode 100644 index 0000000..402eebc --- /dev/null +++ b/errors @@ -0,0 +1,10 @@ +https://data.moviebuff.com/pink-2016-hindi +panic: runtime error: invalid memory address or nil pointer dereference +[signal 0xc0000005 code=0x0 addr=0x0 pc=0xe7060d] + +goroutine 1 [running]: +main.findDegreesOfSeparation({0xc0000ac080, 0x10}, {0xc0000ac0b0, 0xe}) + C:/Users/Maheshwaran S/OneDrive/Documents/interview/qube/challenge2015/chatg.go:133 +0x38d +main.main() + C:/Users/Maheshwaran S/OneDrive/Documents/interview/qube/challenge2015/chatg.go:303 +0xb7 +exit status 2 \ No newline at end of file diff --git a/great.json b/great.json new file mode 100644 index 0000000..76c4d01 --- /dev/null +++ b/great.json @@ -0,0 +1,674 @@ +{ + "url": "the-great-gatsby", + "type": "Movie", + "name": "The Great Gatsby", + "cast": [ + { + "url": "carey-mulligan", + "name": "Carey Mulligan", + "role": "Actress" + }, + { + "url": "leonardo-dicaprio", + "name": "Leonardo DiCaprio", + "role": "Actor" + }, + { + "url": "adelaide-clemens", + "name": "Adelaide Clemens", + "role": "Supporting Actress" + }, + { + "url": "amitabh-bachchan", + "name": "Amitabh Bachchan", + "role": "Supporting Actor" + }, + { + "url": "barrie-laws", + "name": "Barrie Laws", + "role": "Supporting Actor" + }, + { + "url": "barry-otto", + "name": "Barry Otto", + "role": "Supporting Actor" + }, + { + "url": "brendan-maclean", + "name": "Brendan Maclean", + "role": "Supporting Actor" + }, + { + "url": "brenton-prince", + "name": "Brenton Prince", + "role": "Supporting Actor" + }, + { + "url": "brian-rooney", + "name": "Brian Rooney", + "role": "Supporting Actor" + }, + { + "url": "callan-mcauliffe", + "name": "Callan McAuliffe", + "role": "Supporting Actor" + }, + { + "url": "charlize-skinner", + "name": "Charlize Skinner", + "role": "Supporting Actress" + }, + { + "url": "conor-fogarty", + "name": "Conor Fogarty", + "role": "Supporting Actor" + }, + { + "url": "daniel-gill", + "name": "Daniel Gill", + "role": "Supporting Actor" + }, + { + "url": "david-furlong", + "name": "David Furlong", + "role": "Supporting Actor" + }, + { + "url": "eden-falk", + "name": "Eden Falk", + "role": "Supporting Actor" + }, + { + "url": "elizabeth-debicki", + "name": "Elizabeth Debicki", + "role": "Supporting Actress" + }, + { + "url": "emily-foreman", + "name": "Emily Foreman", + "role": "Supporting Actress" + }, + { + "url": "emmanuel-ekwenski", + "name": "Emmanuel Ekwenski", + "role": "Supporting Actor" + }, + { + "url": "frank-aldridge", + "name": "Frank Aldridge", + "role": "Supporting Actor" + }, + { + "url": "garrett-william-fountain", + "name": "Garrett William Fountain", + "role": "Supporting Actor" + }, + { + "url": "gemma-ward", + "name": "Gemma Ward", + "role": "Supporting Actress" + }, + { + "url": "goran-d-kleut", + "name": "Goran D Kleut", + "role": "Supporting Actor" + }, + { + "url": "gus-murray", + "name": "Gus Murray", + "role": "Supporting Actor" + }, + { + "url": "hamish-michael", + "name": "Hamish Michael", + "role": "Supporting Actor" + }, + { + "url": "isla-fisher", + "name": "Isla Fisher", + "role": "Supporting Actress" + }, + { + "url": "jack-thompson", + "name": "Jack Thompson", + "role": "Supporting Actor" + }, + { + "url": "jason-clarke", + "name": "Jason Clarke", + "role": "Supporting Actor" + }, + { + "url": "joel-edgerton", + "name": "Joel Edgerton", + "role": "Supporting Actor" + }, + { + "url": "john-maumau", + "name": "John Maumau", + "role": "Supporting Actor" + }, + { + "url": "kasia-stelmach", + "name": "Kasia Stelmach", + "role": "Supporting Actress" + }, + { + "url": "kate-mulvany", + "name": "Kate Mulvany", + "role": "Supporting Actress" + }, + { + "url": "kevin-mcglothan", + "name": "Kevin McGlothan", + "role": "Supporting Actor" + }, + { + "url": "kim-knuckey", + "name": "Kim Knuckey", + "role": "Supporting Actor" + }, + { + "url": "lisa-adam", + "name": "Lisa Adam", + "role": "Supporting Actress" + }, + { + "url": "mal-day", + "name": "Mal Day", + "role": "Supporting Actor" + }, + { + "url": "mark-lemon", + "name": "Mark Lemon", + "role": "Supporting Actor" + }, + { + "url": "max-cullen", + "name": "Max Cullen", + "role": "Supporting Actor" + }, + { + "url": "milan-pulvermacher", + "name": "Milan Pulvermacher", + "role": "Supporting Actor" + }, + { + "url": "nick-tate", + "name": "Nick Tate", + "role": "Supporting Actor" + }, + { + "url": "price-johnson", + "name": "Price Johnson", + "role": "Supporting Actor" + }, + { + "url": "richard-carter", + "name": "Richard Carter", + "role": "Supporting Actor" + }, + { + "url": "stephen-james-king", + "name": "Stephen James King", + "role": "Supporting Actor" + }, + { + "url": "steve-bisley", + "name": "Steve Bisley", + "role": "Supporting Actor" + }, + { + "url": "sylvana-vandertouw", + "name": "Sylvana Vandertouw", + "role": "Supporting Actress" + }, + { + "url": "tasman-palazzi", + "name": "Tasman Palazzi", + "role": "Supporting Actor" + }, + { + "url": "tiger-leacey-wyvill", + "name": "Tiger Leacey Wyvill", + "role": "Supporting Actress" + }, + { + "url": "tobey-maguire", + "name": "Tobey Maguire", + "role": "Supporting Actor" + }, + { + "url": "vince-colosimo", + "name": "Vince Colosimo", + "role": "Supporting Actor" + } + ], + "crew": [ + { + "name": "Baz Luhrmann", + "url": "baz-luhrmann", + "role": "Director / Direction" + }, + { + "name": "Emma Jamvold", + "url": "emma-jamvold", + "role": "First Assistant Director / Direction" + }, + { + "name": "Jennifer Leacey", + "url": "jennifer-leacey", + "role": "First Assistant Director / Direction" + }, + { + "name": "Glenn Ruehland", + "url": "glenn-ruehland", + "role": "Second Unit Director / Direction" + }, + { + "name": "Luke Doolan", + "url": "luke-doolan", + "role": "Second Unit Director / Direction" + }, + { + "name": "Darwin Brooks", + "url": "darwin-brooks", + "role": "Assistant Director / Direction" + }, + { + "name": "Eddie Thorne", + "url": "eddie-thorne", + "role": "Assistant Director / Direction" + }, + { + "name": "Henry Downes", + "url": "henry-downes", + "role": "Assistant Director / Direction" + }, + { + "name": "Peter Dunlop", + "url": "peter-dunlop", + "role": "Assistant Director / Direction" + }, + { + "name": "Samantha Smith", + "url": "samantha-smith", + "role": "Assistant Director / Direction" + }, + { + "name": "Baz Luhrmann", + "url": "baz-luhrmann", + "role": "Producer / Production" + }, + { + "name": "Catherine Knapman\t", + "url": "catherine-knapman", + "role": "Producer / Production" + }, + { + "name": "Catherine Martin", + "url": "catherine-martin", + "role": "Producer / Production" + }, + { + "name": "Douglas Wick", + "url": "douglas-wick", + "role": "Producer / Production" + }, + { + "name": "Lucy Fisher", + "url": "lucy-fisher", + "role": "Producer / Production" + }, + { + "name": "A\u0026E Television Networks", + "url": "a-and-e-television-networks", + "role": "Production Company / Production" + }, + { + "name": "Bazmark Films", + "url": "bazmark-films", + "role": "Production Company / Production" + }, + { + "name": "Red Wagon Entertainment", + "url": "red-wagon-entertainment", + "role": "Production Company / Production" + }, + { + "name": "Warner Bros. Pictures", + "url": "warner-bros-pictures", + "role": "Production Company / Production" + }, + { + "name": "Anton Monsted", + "url": "anton-monsted", + "role": "Co-Producer / Production" + }, + { + "name": "Barrie M Osborne", + "url": "barrie-m-osborne", + "role": "Executive Producer / Production" + }, + { + "name": "Bruce Berman", + "url": "bruce-berman", + "role": "Executive Producer / Production" + }, + { + "name": "Alex Taussig", + "url": "alex-taussig", + "role": "Unit Production Manager / Production" + }, + { + "name": "ACME Film", + "url": "acme-film", + "role": "Distributor / Distribution" + }, + { + "name": "Golden Village Pictures", + "url": "golden-village-pictures", + "role": "Distributor / Distribution" + }, + { + "name": "Warner Bros", + "url": "warner-bros", + "role": "Distributor / Distribution" + }, + { + "name": "Warner Bros. Entertainment", + "url": "warner-bros-entertainment", + "role": "Distributor / Distribution" + }, + { + "name": "Baz Luhrmann", + "url": "baz-luhrmann", + "role": "Screenplay Writer / Writers" + }, + { + "name": "Craig Pearce", + "url": "craig-pearce", + "role": "Screenplay Writer / Writers" + }, + { + "name": "Simon Duggan", + "url": "simon-duggan", + "role": "Director of Photography / Camera and Electrical" + }, + { + "name": "Craig Armstrong", + "url": "craig-armstrong", + "role": "Music Director / Music" + }, + { + "name": "Universal Music Australia", + "url": "universal-music-australia", + "role": "Music Label / Music" + }, + { + "name": "Damian Candusso", + "url": "damian-candusso", + "role": "Sound Effects Editor / Sound" + }, + { + "name": "Damon Mouris", + "url": "damon-mouris", + "role": "Sound Effects Editor / Sound" + }, + { + "name": "Rick Lisle", + "url": "rick-lisle", + "role": "Sound Effects Editor / Sound" + }, + { + "name": "Fabian Sanjurjo", + "url": "fabian-sanjurjo", + "role": "Sound Format Supervisor / Sound" + }, + { + "name": "Glenn Butler", + "url": "glenn-butler", + "role": "Sound Re-recording Mixer / Sound" + }, + { + "name": "Guntis Sics", + "url": "guntis-sics", + "role": "Location Sound Recordist / Sound" + }, + { + "name": "Ines Richter", + "url": "ines-richter", + "role": "Sound Editor / Sound" + }, + { + "name": "Libby Villa", + "url": "libby-villa", + "role": "Sound Editor / Sound" + }, + { + "name": "William Ward", + "url": "william-ward", + "role": "Sound Editor / Sound" + }, + { + "name": "Andy Bradfield", + "url": "andy-bradfield", + "role": "Assistant Mix Engineer / Sound" + }, + { + "name": "Ian Thomson", + "url": "ian-thomson", + "role": "Audio Assistant / Sound" + }, + { + "name": "Catherine Martin", + "url": "catherine-martin", + "role": "Production Designer / Art" + }, + { + "name": "Damien Drew", + "url": "damien-drew", + "role": "Art Director / Art" + }, + { + "name": "Ian Gracie", + "url": "ian-gracie", + "role": "Art Director / Art" + }, + { + "name": "Michael Turner\t", + "url": "michael-turner", + "role": "Art Director / Art" + }, + { + "name": "Beverley Dunn", + "url": "beverley-dunn", + "role": "Set Decorator / Art" + }, + { + "name": "Nikki Barrett", + "url": "nikki-barrett", + "role": "Casting Director / Casting" + }, + { + "name": "Ronna Kress", + "url": "ronna-kress", + "role": "Casting Director / Casting" + }, + { + "name": "Catherine Martin", + "url": "catherine-martin", + "role": "Costume Designer / Costume and Wardrobe" + }, + { + "name": "Jason Ballantine", + "url": "jason-ballantine", + "role": "Editor / Editorial" + }, + { + "name": "Jonathan Redmond", + "url": "jonathan-redmond", + "role": "Editor / Editorial" + }, + { + "name": "Matt Villa", + "url": "matt-villa", + "role": "Editor / Editorial" + }, + { + "name": "Catherine Biggs", + "url": "catherine-biggs", + "role": "Makeup Artist / Makeup and Hair" + }, + { + "name": "Diane Dusting", + "url": "diane-dusting", + "role": "Makeup Artist / Makeup and Hair" + }, + { + "name": "Lara Jade Birch", + "url": "lara-jade-birch", + "role": "Makeup Artist / Makeup and Hair" + }, + { + "name": "Matteo Silvi", + "url": "matteo-silvi", + "role": "Makeup Artist / Makeup and Hair" + }, + { + "name": "Lara Jade Birch", + "url": "lara-jade-birch", + "role": "Hair Stylist / Makeup and Hair" + }, + { + "name": "Warren Hanneman", + "url": "warren-hanneman", + "role": "Hair Stylist / Makeup and Hair" + }, + { + "name": "Andrea Berchtold", + "url": "andrea-berchtold", + "role": "Stunt Director / Stunts" + }, + { + "name": "Tony Lynch", + "url": "tony-lynch", + "role": "Stunt Director / Stunts" + }, + { + "name": "Ashley Fairfield", + "url": "ashley-fairfield", + "role": "Stunt Coordinator / Stunts" + }, + { + "name": "Glenn Ruehland", + "url": "glenn-ruehland", + "role": "Stunt Coordinator / Stunts" + }, + { + "name": "Ben Toyer", + "url": "ben-toyer", + "role": "Stunt Performer / Stunts" + }, + { + "name": "Blake Lindsell", + "url": "blake-lindsell", + "role": "Stunt Performer / Stunts" + }, + { + "name": "Joel Amos Byrnes", + "url": "joel-amos-byrnes", + "role": "Stunt Performer / Stunts" + }, + { + "name": "Karl Van Moorsel", + "url": "karl-van-moorsel", + "role": "Stunt Performer / Stunts" + }, + { + "name": "Leon Stripp", + "url": "leon-stripp", + "role": "Stunt Performer / Stunts" + }, + { + "name": "Neal Horton", + "url": "neal-horton", + "role": "Stunt Performer / Stunts" + }, + { + "name": "Philip Partridge", + "url": "philip-partridge", + "role": "Stunt Performer / Stunts" + }, + { + "name": "Rea Corcoran", + "url": "rea-corcoran", + "role": "Stunt Performer / Stunts" + }, + { + "name": "Stephen Murdoch", + "url": "stephen-murdoch", + "role": "Stunt Performer / Stunts" + }, + { + "name": "Ingrid Kleinig", + "url": "ingrid-kleinig", + "role": "Stunt Double / Stunts" + }, + { + "name": "Nash Edgerton", + "url": "nash-edgerton", + "role": "Stunt Double / Stunts" + }, + { + "name": "Lee Adamson", + "url": "lee-adamson", + "role": "Stunt Driver / Stunts" + }, + { + "name": "Darren A Bell", + "url": "darren-a-bell", + "role": "Visual Effects Producer / Visual Effects" + }, + { + "name": "Gayle Munro", + "url": "gayle-munro", + "role": "Visual Effects Producer / Visual Effects" + }, + { + "name": "Ineke Majoor", + "url": "ineke-majoor", + "role": "Visual Effects Producer / Visual Effects" + }, + { + "name": "Ingrid Johnston", + "url": "ingrid-johnston", + "role": "Visual Effects Producer / Visual Effects" + }, + { + "name": "Jacqueline Lopez", + "url": "jacqueline-lopez", + "role": "Visual Effects Producer / Visual Effects" + }, + { + "name": "Joyce Cox", + "url": "joyce-cox", + "role": "Visual Effects Producer / Visual Effects" + }, + { + "name": "Prue Fletcher", + "url": "prue-fletcher", + "role": "Visual Effects Producer / Visual Effects" + }, + { + "name": "Richard Thwaites", + "url": "richard-thwaites", + "role": "Visual Effects Producer / Visual Effects" + }, + { + "name": "Sarah Cauchois", + "url": "sarah-cauchois", + "role": "Visual Effects Producer / Visual Effects" + } + ] +} \ No newline at end of file diff --git a/main.go b/main.go new file mode 100644 index 0000000..d73b26f --- /dev/null +++ b/main.go @@ -0,0 +1,91 @@ +package main + +import ( + "crypto/tls" + "encoding/json" + "fmt" + "net/http" + "os" +) + +func main() { + args := os.Args + defer func() { + if err := recover(); err != nil { + fmt.Printf("\nPanic occurred: %+v", err) + return + } + }() + if len(args) < 3 || len(args) > 3 { + fmt.Println("invalid command line") + } + cmd := args[1] + var degree int + + switch cmd { + default: + fmt.Println("\nInvalid command command line") + return + case "degrees": + fmt.Scanf("Degrees of Separation: %d", °ree) + } + + movie := args[2] + person := args[3] + + fetchInfo(movie, person) +} + +func fetchInfo(movie, person string) { + +} + +type Movie struct { + URL string `json:"url"` + Name string `json:"name"` + Type string `json:"type"` + Cast []cast `json:"cast"` +} + +// type cast struct { +// Name string `json:"name"` +// URL string `json:"url"` +// Role string `json:"role"` +// } + +type Person struct { + URL string `json:"url"` + Name string `json:"name"` + Type string `json:"type"` + Movies []cast `json:"movies"` +} + +func fetchMovie(movie, person string) { + + baseURL := "http://data.moviebuff.com/" + movieURL := fmt.Sprint("%s%s", baseURL, movie) + req, err := http.NewRequest(http.MethodGet, movieURL, nil) + if err != nil { + //handle error + } + + tlsConfig := tls.Config{ + MinVersion: tls.VersionTLS13, + InsecureSkipVerify: true, + } + // Skipping verification as it is done manually using digest of the TLS certificate as this is step of setting up service + transport := http.Transport{ + TLSClientConfig: &tlsConfig, + } + client := &http.Client{Transport: &transport} + resp, err := client.Do(req) + if err != nil { + + } + + err = json.NewDecoder(resp.Body).Decode(&userCreateResponse) + if err != nil { + return nil, err + } + +} diff --git a/robert.json b/robert.json new file mode 100644 index 0000000..d89b4a1 --- /dev/null +++ b/robert.json @@ -0,0 +1,87 @@ +{ + "url": "robert-de-niro", + "type": "Person", + "name": "Robert De Niro", + "movies": [ + { + "name": "Hands of Stone", + "url": "hands-of-stone", + "role": "Actor" + }, + { + "name": "Idol's Eye", + "url": "idols-eye", + "role": "Actor" + }, + { + "name": "The Intern", + "url": "the-intern", + "role": "Actor" + }, + { + "name": "American Hustle", + "url": "american-hustle", + "role": "Supporting Actor" + }, + { + "name": "Grudge Match", + "url": "grudge-match", + "role": "Actor" + }, + { + "name": "Last Vegas", + "url": "last-vegas", + "role": "Actor" + }, + { + "name": "Malavita", + "url": "the-family", + "role": "Actor" + }, + { + "name": "Killing Season", + "url": "killing-season", + "role": "Actor" + }, + { + "name": "The Big Wedding", + "url": "the-big-wedding", + "role": "Actor" + }, + { + "name": "Silver Linings Playbook", + "url": "silver-linings-playbook", + "role": "Actor" + }, + { + "name": "Analyze This", + "url": "analyze-this", + "role": "Actor" + }, + { + "name": "Cape Fear", + "url": "cape-fear", + "role": "Actor" + }, + { + "name": "Goodfellas", + "url": "goodfellas", + "role": "Actor" + }, + { + "name": "The Deer Hunter", + "url": "the-deer-hunter", + "role": "Actor" + }, + { + "name": "Taxi Driver", + "url": "taxi-driver", + "role": "Actor" + }, + { + "name": "The Godfather: Part II", + "url": "the-godfather-part-ii", + "role": "Supporting Actor" + } + ] +} \ No newline at end of file