Форум программистов, компьютерный форум, киберфорум
C# для начинающих
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.80/5: Рейтинг темы: голосов - 5, средняя оценка - 4.80
0 / 0 / 0
Регистрация: 29.10.2016
Сообщений: 39
1

Консольное приложение поиска

24.04.2017, 13:59. Показов 897. Ответов 7
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Дали задание по программированию:
"Написать консольное приложение поиска музыкальных альбомов исполнителя. При вводе пользователем названия группы, программа должна запрашивать сервер в поисках списка её альбомов. При отсутствии соединения с сервером, список (если он был загружен ранее) должен подгружаться из локального кэша. Допускается использование любого сервера с любым API (рекомендуется сервис iTunes как не требующий авторизации). Для хранения кэша допускается использование любого носителя (файл, любая база данных). Допускается использование любых сторонних библиотек."

Но я абсолютно не знаю как это сделать, даже с чего начать. Помогите, пожалуйста!
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
24.04.2017, 13:59
Ответы с готовыми решениями:

разработать консольное приложение для ввода с клавиатуры массива строк и поиска среди них строк, содержащих заданный строковый фрагмент.
Помогите пожалуйстааа!!! Не пойму как это сделать на C#. Контрольное задание Необходимо...

Консольное приложение
Здравствуйте. Подскажите Пожалуйта как можно сделать повтор приложения к примеру: int...

консольное приложение
Помогите реализовать задачу Написать на С# код консольного приложения, реализующий в главной...

Консольное приложение
Задача: составить программу вычисления функции.Вывести результат вычисления и величину,от которой...

7
Администратор
Эксперт .NET
17022 / 13374 / 5218
Регистрация: 17.03.2014
Сообщений: 27,351
Записей в блоге: 1
24.04.2017, 14:37 2
AndreyVoronin52, если делать через itunes, то понадобится
а) делать http запрос - смотри классы HttpClient, WebClient
б) парсить JSON ответ - библиотека Json.Net
в) файловый кеш можно сделать с помощью xml сериализации при принципу один артист - один файл со списком альбомов. Кеш в БД будет несложно сделать если взять документую БД вроде RavenDB

Запросы к сервису iTunes нужо делать такие
1) список исполнителей по имени чтобы узнать его ID
https://itunes.apple.com/searc... =allArtist
Если в списке есть точное совпадение, то берем artistId и делаем запрос списка альбомов. Если нет, то предлагаем пользователю уточнить кого он имеет в виду

2) Список альбомов
https://itunes.apple.com/looku... tity=album
1
0 / 0 / 0
Регистрация: 29.10.2016
Сообщений: 39
30.04.2017, 20:46  [ТС] 3
Для кэша я могу использовать каталог?
0
Администратор
Эксперт .NET
17022 / 13374 / 5218
Регистрация: 17.03.2014
Сообщений: 27,351
Записей в блоге: 1
30.04.2017, 21:24 4
AndreyVoronin52, можешь
0
0 / 0 / 0
Регистрация: 29.10.2016
Сообщений: 39
05.05.2017, 08:14  [ТС] 5
Как с помощью JSON.Net мне извлекать ID исполнителей?
0
Администратор
Эксперт .NET
17022 / 13374 / 5218
Регистрация: 17.03.2014
Сообщений: 27,351
Записей в блоге: 1
06.05.2017, 01:57 6
AndreyVoronin52, примерно так
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
string json = "{\r\n \"resultCount\":33,\r\n \"results\": [\r\n{\"wrapperType\":\"artist\", \"artistType\":\"Arti" +
    "st\", \"artistName\":\"The Beatles\", \"artistLinkUrl\":\"https://itunes.apple.com/us/ar" +
    "tist/the-beatles/id136975?uo=4\", \"artistId\":136975, \"amgArtistId\":3644, \"primary" +
    "GenreName\":\"Rock\", \"primaryGenreId\":21}, \r\n{\"wrapperType\":\"artist\", \"artistType\"" +
    ":\"Artist\", \"artistName\":\"Beatles Celebration\", \"artistLinkUrl\":\"https://itunes.a" +
    "pple.com/us/artist/beatles-celebration/id369309908?uo=4\", \"artistId\":369309908, " +
    "\"primaryGenreName\":\"Pop\", \"primaryGenreId\":14}, \r\n{\"wrapperType\":\"artist\", \"arti" +
    "stType\":\"Artist\", \"artistName\":\"Blues Beatles\", \"artistLinkUrl\":\"https://itunes." +
    "apple.com/us/artist/blues-beatles/id1177076976?uo=4\", \"artistId\":1177076976, \"pr" +
    "imaryGenreName\":\"Blues\", \"primaryGenreId\":2}, \r\n{\"wrapperType\":\"artist\", \"artist" +
    "Type\":\"Artist\", \"artistName\":\"Bornagen Beatles\", \"artistLinkUrl\":\"https://itunes" +
    ".apple.com/us/artist/bornagen-beatles/id417746653?uo=4\", \"artistId\":417746653, \"" +
    "primaryGenreName\":\"Pop\", \"primaryGenreId\":14}, \r\n{\"wrapperType\":\"artist\", \"artis" +
    "tType\":\"Artist\", \"artistName\":\"The Beatles Symphonic Orchestra\", \"artistLinkUrl\"" +
    ":\"https://itunes.apple.com/us/artist/the-beatles-symphonic-orchestra/id410698389" +
    "?uo=4\", \"artistId\":410698389}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\"," +
    " \"artistName\":\"The Platinum Beatles\", \"artistLinkUrl\":\"https://itunes.apple.com/" +
    "us/artist/the-platinum-beatles/id371061808?uo=4\", \"artistId\":371061808, \"primary" +
    "GenreName\":\"Pop\", \"primaryGenreId\":14}, \r\n{\"wrapperType\":\"artist\", \"artistType\":" +
    "\"Artist\", \"artistName\":\"3 Normal Beatles\", \"artistLinkUrl\":\"https://itunes.apple" +
    ".com/us/artist/3-normal-beatles/id269076416?uo=4\", \"artistId\":269076416, \"primar" +
    "yGenreName\":\"Alternative\", \"primaryGenreId\":20}, \r\n{\"wrapperType\":\"artist\", \"art" +
    "istType\":\"Artist\", \"artistName\":\"Songs The Beatles Gave Away\", \"artistLinkUrl\":\"" +
    "https://itunes.apple.com/us/artist/songs-the-beatles-gave-away/id321298056?uo=4\"" +
    ", \"artistId\":321298056, \"primaryGenreName\":\"Rock\", \"primaryGenreId\":21}, \r\n{\"wra" +
    "pperType\":\"artist\", \"artistType\":\"Artist\", \"artistName\":\"#1 Beatles Lovers\", \"ar" +
    "tistLinkUrl\":\"https://itunes.apple.com/us/artist/1-beatles-lovers/id370331152?uo" +
    "=4\", \"artistId\":370331152, \"primaryGenreName\":\"Pop\", \"primaryGenreId\":14}, \r\n{\"w" +
    "rapperType\":\"artist\", \"artistType\":\"Artist\", \"artistName\":\"Savage Young Beatles\"" +
    ", \"artistLinkUrl\":\"https://itunes.apple.com/us/artist/savage-young-beatles/id796" +
    "23511?uo=4\", \"artistId\":79623511, \"amgArtistId\":877930, \"primaryGenreName\":\"Danc" +
    "e\", \"primaryGenreId\":17}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\", \"art" +
    "istName\":\"Beatles Revival Band\", \"artistLinkUrl\":\"https://itunes.apple.com/us/ar" +
    "tist/beatles-revival-band/id215066533?uo=4\", \"artistId\":215066533, \"primaryGenre" +
    "Name\":\"Pop\", \"primaryGenreId\":14}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Arti" +
    "st\", \"artistName\":\"The Rolling Beatles\", \"artistLinkUrl\":\"https://itunes.apple.c" +
    "om/us/artist/the-rolling-beatles/id439964146?uo=4\", \"artistId\":439964146, \"prima" +
    "ryGenreName\":\"Pop\", \"primaryGenreId\":14}, \r\n{\"wrapperType\":\"artist\", \"artistType" +
    "\":\"Artist\", \"artistName\":\"The Beatles Revival Band & Orchestra\", \"artistLinkUrl\"" +
    ":\"https://itunes.apple.com/us/artist/the-beatles-revival-band-orchestra/id443425" +
    "560?uo=4\", \"artistId\":443425560, \"primaryGenreName\":\"Pop\", \"primaryGenreId\":14}," +
    " \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\", \"artistName\":\"The Beatles Con" +
    "nection\", \"artistLinkUrl\":\"https://itunes.apple.com/us/artist/the-beatles-connec" +
    "tion/id911648932?uo=4\", \"artistId\":911648932, \"primaryGenreName\":\"Britpop\", \"pri" +
    "maryGenreId\":1132}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\", \"artistNam" +
    "e\":\"The Philharmonic Beatles Experience\", \"artistLinkUrl\":\"https://itunes.apple." +
    "com/us/artist/the-philharmonic-beatles-experience/id410698395?uo=4\", \"artistId\":" +
    "410698395}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\", \"artistName\":\"The " +
    "Savage Young Beatles\", \"artistLinkUrl\":\"https://itunes.apple.com/us/artist/the-s" +
    "avage-young-beatles/id304600324?uo=4\", \"artistId\":304600324, \"amgArtistId\":87793" +
    "0, \"primaryGenreName\":\"Rock\", \"primaryGenreId\":21}, \r\n{\"wrapperType\":\"artist\", \"" +
    "artistType\":\"Artist\", \"artistName\":\"The Bootleg Beatles\", \"artistLinkUrl\":\"https" +
    "://itunes.apple.com/us/artist/the-bootleg-beatles/id165911529?uo=4\", \"artistId\":" +
    "165911529}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Software Artist\", \"artistNa" +
    "me\":\"Beat-les Group IKE\", \"artistLinkUrl\":\"https://itunes.apple.com/us/developer" +
    "/beat-les-group-ike/id1195719806?uo=4\", \"artistId\":1195719806}, \r\n{\"wrapperType\"" +
    ":\"artist\", \"artistType\":\"Artist\", \"artistName\":\"The Savage Young Beatles featuri" +
    "ng Tony Sheridan\", \"artistLinkUrl\":\"https://itunes.apple.com/us/artist/the-savag" +
    "e-young-beatles-featuring-tony-sheridan/id288180269?uo=4\", \"artistId\":288180269," +
    " \"primaryGenreName\":\"Rock\", \"primaryGenreId\":21}, \r\n{\"wrapperType\":\"artist\", \"ar" +
    "tistType\":\"Artist\", \"artistName\":\"The Beatles Acoustic Trio\", \"artistLinkUrl\":\"h" +
    "ttps://itunes.apple.com/us/artist/the-beatles-acoustic-trio/id976631872?uo=4\", \"" +
    "artistId\":976631872, \"primaryGenreName\":\"Pop\", \"primaryGenreId\":14}, \r\n{\"wrapper" +
    "Type\":\"artist\", \"artistType\":\"Artist\", \"artistName\":\"The New York Beatles Show\"," +
    " \"artistLinkUrl\":\"https://itunes.apple.com/us/artist/the-new-york-beatles-show/i" +
    "d370546235?uo=4\", \"artistId\":370546235, \"primaryGenreName\":\"Pop\", \"primaryGenreI" +
    "d\":14}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\", \"artistName\":\"The Sava" +
    "ge Young Beatles with Tony Sheridan\", \"artistLinkUrl\":\"https://itunes.apple.com/" +
    "us/artist/the-savage-young-beatles-with-tony-sheridan/id984990630?uo=4\", \"artist" +
    "Id\":984990630}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\", \"artistName\":\"" +
    "The Ukulele Beatles\", \"artistLinkUrl\":\"https://itunes.apple.com/us/artist/the-uk" +
    "ulele-beatles/id606182486?uo=4\", \"artistId\":606182486, \"primaryGenreName\":\"Pop\"," +
    " \"primaryGenreId\":14}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\", \"artist" +
    "Name\":\"#1 Beatles Fantasy Band\", \"artistLinkUrl\":\"https://itunes.apple.com/us/ar" +
    "tist/1-beatles-fantasy-band/id370546167?uo=4\", \"artistId\":370546167}, \r\n{\"wrappe" +
    "rType\":\"artist\", \"artistType\":\"Artist\", \"artistName\":\"Memphis Loves The Beatles " +
    "Studio Band\", \"artistLinkUrl\":\"https://itunes.apple.com/us/artist/memphis-loves-" +
    "the-beatles-studio-band/id673285434?uo=4\", \"artistId\":673285434, \"primaryGenreNa" +
    "me\":\"R&B/Soul\", \"primaryGenreId\":15}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"A" +
    "rtist\", \"artistName\":\"The Tape-Beatles\", \"artistLinkUrl\":\"https://itunes.apple.c" +
    "om/us/artist/the-tape-beatles/id1165121174?uo=4\", \"artistId\":1165121174, \"primar" +
    "yGenreName\":\"Electronic\", \"primaryGenreId\":7}, \r\n{\"wrapperType\":\"artist\", \"artis" +
    "tType\":\"Artist\", \"artistName\":\"Bootleg Beatles\", \"artistLinkUrl\":\"https://itunes" +
    ".apple.com/us/artist/bootleg-beatles/id370627110?uo=4\", \"artistId\":370627110}, \r" +
    "\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\", \"artistName\":\"Tampere Beatles H" +
    "appening\", \"artistLinkUrl\":\"https://itunes.apple.com/us/artist/tampere-beatles-h" +
    "appening/id1082950038?uo=4\", \"artistId\":1082950038, \"primaryGenreName\":\"Pop\", \"p" +
    "rimaryGenreId\":14}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\", \"artistNam" +
    "e\":\"Japanese Beatles\", \"artistLinkUrl\":\"https://itunes.apple.com/us/artist/japan" +
    "ese-beatles/id453677615?uo=4\", \"artistId\":453677615, \"primaryGenreName\":\"Alterna" +
    "tive\", \"primaryGenreId\":20}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\", \"" +
    "artistName\":\"Beatle\'s Wart\", \"artistLinkUrl\":\"https://itunes.apple.com/us/artist" +
    "/beatles-wart/id577701203?uo=4\", \"artistId\":577701203, \"amgArtistId\":2992181, \"p" +
    "rimaryGenreName\":\"Pop\", \"primaryGenreId\":14}, \r\n{\"wrapperType\":\"artist\", \"artist" +
    "Type\":\"Artist\", \"artistName\":\"BPC - Beatles Para Crianças\", \"artistLinkUrl\":\"htt" +
    "ps://itunes.apple.com/us/artist/bpc-beatles-para-crian%C3%A7as/id1134646093?uo=4" +
    "\", \"artistId\":1134646093, \"primaryGenreName\":\"Children\'s Music\", \"primaryGenreId" +
    "\":4}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\", \"artistName\":\"The Beatle" +
    "s etcetera\", \"artistLinkUrl\":\"https://itunes.apple.com/us/artist/the-beatles-etc" +
    "etera/id388195904?uo=4\", \"artistId\":388195904, \"primaryGenreName\":\"Spoken Word\"," +
    " \"primaryGenreId\":50000061}, \r\n{\"wrapperType\":\"artist\", \"artistType\":\"Artist\", \"" +
    "artistName\":\"Los Beatles De Cadiz\", \"artistLinkUrl\":\"https://itunes.apple.com/us" +
    "/artist/los-beatles-de-cadiz/id255880236?uo=4\", \"artistId\":255880236, \"primaryGe" +
    "nreName\":\"Pop\", \"primaryGenreId\":14}]\r\n}";
JObject j = JObject.Parse(json);
int resultCount = (int)j["resultCount"];
JArray jArtists = (JArray)j["results"];
for (int i=0; i<resultCount; i++)
{
    string artistName = (string)jArtists[i]["artistName"];
    int artistId = (int)jArtists[i]["artistId"];
    Console.WriteLine("{0}, {1}", artistName, artistId);
}
1
0 / 0 / 0
Регистрация: 29.10.2016
Сообщений: 39
06.05.2017, 09:07  [ТС] 7
А через ссылку не как нельзя или надо обязательно это всё вводить
0
Администратор
Эксперт .NET
17022 / 13374 / 5218
Регистрация: 17.03.2014
Сообщений: 27,351
Записей в блоге: 1
06.05.2017, 12:38 8
AndreyVoronin52, мржно. Для этого надо
Цитата Сообщение от OwenGlendower Посмотреть сообщение
сделать http запрос - смотри классы HttpClient, WebClient
, присвоить перемеменной json результат запроса и далее по примеру.
1
06.05.2017, 12:38
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
06.05.2017, 12:38
Помогаю со студенческими работами здесь

Многопоточное консольное приложение C#
Здравствуйте,подскажите пожалуйста как сделать это задание? Потоки знаю,сделать смогу. Не знаю как...

Консольное приложение с аргументами
Не получается сделать приложение калькулятор с передачей параметров из консоли. У приложение есть...

Запароленное консольное приложение
Создайте в VisuaI Studio прототип консольного приложения C#, защищенного паролем от запуска. При...

консольное многопоточное приложение на си#
Привет! Помогите пожалуйста, не могу разобраться с задачей( задача следующая: Написать консольное...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
8
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru